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

WordPress Trac noreply at wordpress.org
Mon Dec 7 23:00:57 UTC 2015


#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 atimmer):

 I stumbled upon this ticket and because you haven't received any feedback
 I thought I could give some.
 * The JSDoc in the patch misses type declarations.
 * The whole`MethodsAvailable` is weird readability wise. It works because
 the declaration of the variable is hoisted to the top, then the functions
 are hoisted and then `MethodsAvailable` is set to the correct value. I
 think it's better to be explicit that that's going on so to fix that add a
 `var MethodsAvailable` on top and moving the assignment to the bottom.
 * If the first argument of `doAction` is required shouldn't it just be
 placed in the first position in the function declaration? Same goes for
 `applyFilters`.
 * We can document that we accept a list of arguments using 3 dots:
 http://usejsdoc.org/tags-param.html, so for `doAction`: `@param {...}`
 * There is a space missing before the first `(` of all if statements.
 * `_removeHook` doesn't need a context argument because it's never called
 with a context. This also makes the function cleaner.

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


More information about the wp-trac mailing list