[wp-trac] [WordPress Trac] #21170: JavaScript actions and filters

WordPress Trac noreply at wordpress.org
Fri Mar 17 18:17:53 UTC 2017


#21170: JavaScript actions and filters
------------------------------------+------------------------------
 Reporter:  koopersmith             |       Owner:  adamsilverstein
     Type:  feature request         |      Status:  assigned
 Priority:  normal                  |   Milestone:  Future Release
Component:  General                 |     Version:  3.4
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |     Focuses:  javascript
------------------------------------+------------------------------

Comment (by aduth):

 Replying to [comment:115 azaozz]:
 >Do we want to do "jQuery style namespacing" or something similar? The
 problem is removing particular callback from a filter in PHP is very easy
 as the "identifier" is usually a string (even when it is a method). This
 is not the case in JS where a callback cannot be removed if there is no
 reference to it. If not, should we add some easy way to remove specific
 callbacks?

 I dunno, seems more like a "nice to have" than a strictly useful feature.
 Probably a decision better driven by real use-cases, but I suspect in most
 situations I'd want to remove a hook, it'd be within the same scope as a
 reference to the original function anyways. To me, jQuery namespaces are
 most valuable for unbinding from a number of different event names
 simultaneously, something that wouldn't seem a common requirement for
 hooks.

 >In PHP there are `doing_action()`, `did_action()`, and `has_action()`.
 They are somewhat useful in some cases. Do we need equivalents in JS?

 These seem simple enough to implement and maintain that I wouldn't see
 much of a downside to including them even if just for benefit of aligning
 APIs between PHP and JS hooks.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/21170#comment:116>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list