Labs/Jetpack/Reboot/JEP/112: Difference between revisions

Jump to navigation Jump to search
m
(→‎Issues: Updated for changes.)
Line 104: Line 104:
Instead of requiring consumers to manually add and remove items when particular contexts arise, this proposal introduces the notion that items are bound to one or more contexts, much as event listeners are bound to events.  This binding occurs through an item's <tt>context</tt> property.  When the context menu is invoked, all of the items bound to the context giving rise to the menu are added to the menu.  If no items are bound to the context, no items are added to the menu.
Instead of requiring consumers to manually add and remove items when particular contexts arise, this proposal introduces the notion that items are bound to one or more contexts, much as event listeners are bound to events.  This binding occurs through an item's <tt>context</tt> property.  When the context menu is invoked, all of the items bound to the context giving rise to the menu are added to the menu.  If no items are bound to the context, no items are added to the menu.


The <tt>context</tt> property is a collection, similar to event listener collections common throught Jetpack's various APIs.  A single context may be bound by assigning one of the above types to the <tt>context</tt> property either on construction or after:
The <tt>context</tt> property is a collection, similar to event listener collections common throughout Jetpack's various APIs.  A single context may be bound by assigning one of the above types to the <tt>context</tt> property either on construction or after:


<pre class="brush:js;toolbar:false;">
<pre class="brush:js;toolbar:false;">
Confirmed users
764

edits

Navigation menu