README revision e2be19408a54a8ec1c9e810ea4eaa2f0ac7cda07
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil OstlerYUI Custom Events
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler Custom event system
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler3.1.1
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler - No changes
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler3.1.0
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler - Wildcard prefix subscriptions supported:
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler target.on('*:click', ... will be notified when 'tree:click',
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler 'tab:click', etc are fired.
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler - Added EventTarget::once, which is equivalent to on(), except the listener
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler automatically detaches itself once executed.
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler - Added event monitoring. When configured, an event target will
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler emit events for publish, attach, fire, and detach operations on
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler the hosted events.
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler - EventTarget::on's type parameter is overloaded to accept arrays and objects
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler for attaching multiple types at once.
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler - EventTarget::detach returns the event target like the API docs
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler already stated.
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler - Events can now be configured to execute the defaultFn only on the
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler targeted object, not on the bubble targets.
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler - The event order has been reworked so that the after listeners
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler for the entire event stack execute after all defaultFn across
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler the entire bubble stack.
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler3.0.0
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler - Broken into core base and complex modules.
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler - broadcast works for simple events.
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler - If configured to return an event handle, the return value
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler will always be a single object, regardless of how many listeners
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler were attached. Previously, multiple listeners provided an array
71904a856f14edb11a0df179b4a9009829296474Pavel Shapovalov of detach handles.
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler
07eb33b138ab717ce204d0ca8f46ba274f0a314bEugenia Sergueeva3.0.0beta1
07eb33b138ab717ce204d0ca8f46ba274f0a314bEugenia Sergueeva - Implemented the broadcast flag. broadcast = 1: local, accessible
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler via Y.on('prefix:event'). broadcast = 2: global, accessible
8e4852c36d7dda230310402d7caf3c78db77ab04Joe Bandenburg via Y.on or globally via Y.Global.on('prefix:event). Broadcast
8e4852c36d7dda230310402d7caf3c78db77ab04Joe Bandenburg listeners cannot effect the defaultFn or host subscribers (so
8e4852c36d7dda230310402d7caf3c78db77ab04Joe Bandenburg are in effect, after listeners), although this is still possible
8e4852c36d7dda230310402d7caf3c78db77ab04Joe Bandenburg by added either Y or Y.Global as event targets.
d55d971fb3474daa635420d160d4d480701afbbaJulian Kigwana - Moved custom event out of event package
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler - EventTarget accepts a prefix configuration. This is used
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler in all exposed methods to handle shortcuts to event names,
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler e.g., 'click' and 'menu:click' are the same if the prefix
30e50ddbaff38a048aeabb40eb7779757e1162e3Julian Kigwana is 'menu'
30e50ddbaff38a048aeabb40eb7779757e1162e3Julian Kigwana - Exposed methods are 'on' for the before moment, 'after' for
30e50ddbaff38a048aeabb40eb7779757e1162e3Julian Kigwana the after moment, and 'detach' for unsubscribe. subscribe,
30e50ddbaff38a048aeabb40eb7779757e1162e3Julian Kigwana before, unsubscribe, and corresponding methods are deprecated.
415fa8c9e106141955e5e70c73c05597af00b2ccHalina Kaliankovich - Event type accepts a event category which can be used to
415fa8c9e106141955e5e70c73c05597af00b2ccHalina Kaliankovich detach events.
c68455debf3649a04569fe7826486aec2d4b04c9Joe Bandenburg Y.on('category|prefix:event', fn);
8d8b63ccb199200d995f4ed264e9b041e3f74349sean oneill Y.detach('category|prefix:event');
c68455debf3649a04569fe7826486aec2d4b04c9Joe Bandenburg Y.detach('category|*');
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler - Added 'chain' config to events that makes the return value the
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler event target rather than a detach handle. Use with the detach
1b982f1e22faf9f1b7855d0828e6d26a03d7984fPhil Ostler category prefix.
f7786f88fa6726be5b840c5444820ffb211981c5Julian Kigwana - The type parameter can be an object containing multiple events to attach
Y.on( { 'event1': fn1, 'event2': fn2 }
- Y.fire payload for event facades can be another facade or a custom event.