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

WordPress Trac noreply at wordpress.org
Wed Jan 29 20:11:17 UTC 2014


#21170: JavaScript actions and filters
-----------------------------+-----------------------------
 Reporter:  koopersmith      |       Owner:  koopersmith
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  Future Release
Component:  General          |     Version:  3.4
 Severity:  normal           |  Resolution:
 Keywords:  2nd-opinion      |     Focuses:  javascript
-----------------------------+-----------------------------

Comment (by gcorne):

 > Considering that some hooks would be used by core plus 2-3-4 plugins,
 having priority would be great.

 The ability to control execution order is definitely worth having.

 >
 > Agreed, having a scope can be quite handy and will make this better.
 >

 I went ahead and had a go at adding a context parameter. See
 https://github.com/gcorne/WP-JS-
 Hooks/commit/e7ab26d9aae2f5383b8ec156454ce241bcb4a87e

 I also think that we should incorporate the ability to remove a specific
 hook based on {{{===}}} comparison. Something like:

 {{{

 var func = function() {
     // do awesome stuff
 };

 wp.hooks.addAction( 'foo', func );
 // lots of code

 wp.hooks.removeAction( 'foo', func );

 }}}

 We could either make the callback reference optional in {{{ removeAction()
 }}} and when not passed remove all, or perhaps create a separate method
 {{{ removeAllActions() }}}.

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


More information about the wp-trac mailing list