[wp-trac] [WordPress Trac] #38947: Proposition to add an optimized api.Events manager to the api.Value constructor

WordPress Trac noreply at wordpress.org
Thu Jan 26 14:45:13 UTC 2017


#38947: Proposition to add an optimized api.Events manager to the api.Value
constructor
-------------------------+------------------------------
 Reporter:  nikeo        |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Customize    |     Version:  4.7
 Severity:  normal       |  Resolution:
 Keywords:  needs-patch  |     Focuses:  javascript
-------------------------+------------------------------

Comment (by nikeo):

 Two methods have been added to the api.Value constructor
 * `trigger` which triggers the bound callbacks of a specific topic, or
 trigger the anonymous callbacks
 * `unbindAll` which unbinds all previously bound functions of a callbacks
 topic if specified or unbinds all functions if no topic is specified

 The `set` method has been adapted to the new event manager.

 I've also proposed a new optional argument object to the `set` method that
 was not initially scoped in the proposition. The proposed argument allows
 us to "silently" set an `api.Value()` instance, whithout firing the
 callbacks.

 This code ensure a backward compatibility with the current API, since it
 allows to bind an `api.Value` both ways : with or without a topic id.

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


More information about the wp-trac mailing list