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

WordPress Trac noreply at wordpress.org
Thu Sep 14 12:56:58 UTC 2017


#21170: JavaScript actions and filters
-----------------------------+-------------------------
 Reporter:  koopersmith      |       Owner:
     Type:  feature request  |      Status:  assigned
 Priority:  normal           |   Milestone:  4.9
Component:  General          |     Version:  3.4
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:  javascript
-----------------------------+-------------------------

Comment (by adamsilverstein):

 > We do need some more tangible examples to define and implement any
 solution.

 @matveb @azaozz @pento @dd32

 Here are some tangible examples of `wp.hooks` already being used in a
 popular plugins:

 wp.hooks is [https://github.com/wp-shortcake/shortcake/wiki/Event-
 Attribute-Callbacks included in Shortcake]. This plugin has over 20k
 active installs and is actively used on very high traffic enterprise level
 sites.

 wp.hooks is used in [https://www.advancedcustomfields.com/resources
 /adding-custom-javascript-fields/ Advanced Custom Fields]. This plugin has
 over 1 million installs.


 > Primarily, it's mostly unused in real situations

 False. It is actually used in production on large sites in real
 situations.


 > I'd want to see something using a modern library (Be that React, Vue,
 Angular, Whatever) using this pattern before we add it as-is to WordPress

 Why? we don't make use of any 'modern library' in core today and this
 approach may not be applicable to modern JS anyway. '''Using this approach
 on our current JS in no way precludes using a different approach in the
 future''' which is I think the core of our disagreement here.  Why do you
 assume using `wp.hooks` for legacy extensibility means we are locked into
 using it for Gutenberg?

 Choosing what we use in core today based on the needs of Gutenberg is a
 mistake. The decorators, slot & fill patterns, and middlewares being
 explored there are React/Redux based approaches that are unlikely to be
 helpful for extending legacy JavaScript.

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


More information about the wp-trac mailing list