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

WordPress Trac noreply at wordpress.org
Tue Nov 21 13:03:49 UTC 2017


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

Comment (by gziolo):

 Replying to [comment:194 adamsilverstein]:

 > The current plan for core is to experiment with adding hooks for
 extensibility of media and other JavaScript components and decide how to
 expose them. For a platform like WordPress core, it probably makes the
 most sense to expose hooks as a global as the previous patch did, eg.
 `wp.hooks = createHooks();` while plugins may choose to their own
 namespace hooks, eg. `myPlugin.hooks = createHooks();`

 Taking into account what you shared above and in the corresponding PR, I
 updated code to provide a compatibility layer for Gutenberg which exposes
 hooks as `wp.hooks = createHooks();` to use globally for plugin developers
 whenever they want to update something in the editor. To modify experience
 around block we propose `wp.blocks.addFilter`, etc to narrow down the
 scope and provide consistent API with `wp.blocks.registerBlock`. We can
 discuss what is currently propose at the upcoming JS Core chat.

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


More information about the wp-trac mailing list