Confirmed users
764
edits
(→Example Usage: Removed |new| usage, per discussion with Myk on IRC and mailing list) |
(→Specifying Contexts: Forgot about array contexts) |
||
Line 101: | Line 101: | ||
; function: An arbitrary predicate. The context arises when the function returns true. The function is passed an object describing the current context. See [[#Context_Descriptions]]. | ; function: An arbitrary predicate. The context arises when the function returns true. The function is passed an object describing the current context. See [[#Context_Descriptions]]. | ||
; array: An array of any of the other types. | |||
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. |