|
0
|
1 |
YUI Custom Events
|
|
|
2 |
Custom event system
|
|
|
3 |
|
|
|
4 |
3.0.0
|
|
|
5 |
- Broken into core base and complex modules.
|
|
|
6 |
- broadcast works for simple events.
|
|
|
7 |
- If configured to return an event handle, the return value
|
|
|
8 |
will always be a single object, regardless of how many listeners
|
|
|
9 |
were attached. Previously, multiple listeners provided an array
|
|
|
10 |
of detach handles.
|
|
|
11 |
|
|
|
12 |
3.0.0beta1
|
|
|
13 |
- Implemented the broadcast flag. broadcast = 1: local, accessible
|
|
|
14 |
via Y.on('prefix:event'). broadcast = 2: global, accessible
|
|
|
15 |
via Y.on or globally via Y.Global.on('prefix:event). Broadcast
|
|
|
16 |
listeners cannot effect the defaultFn or host subscribers (so
|
|
|
17 |
are in effect, after listeners), although this is still possible
|
|
|
18 |
by added either Y or Y.Global as event targets.
|
|
|
19 |
- Moved custom event out of event package
|
|
|
20 |
- EventTarget accepts a prefix configuration. This is used
|
|
|
21 |
in all exposed methods to handle shortcuts to event names,
|
|
|
22 |
e.g., 'click' and 'menu:click' are the same if the prefix
|
|
|
23 |
is 'menu'
|
|
|
24 |
- Exposed methods are 'on' for the before moment, 'after' for
|
|
|
25 |
the after moment, and 'detach' for unsubscribe. subscribe,
|
|
|
26 |
before, unsubscribe, and corresponding methods are deprecated.
|
|
|
27 |
- Event type accepts a event category which can be used to
|
|
|
28 |
detach events.
|
|
|
29 |
Y.on('category|prefix:event', fn);
|
|
|
30 |
Y.detach('category|prefix:event');
|
|
|
31 |
Y.detach('category|*');
|
|
|
32 |
- Added 'chain' config to events that makes the return value the
|
|
|
33 |
event target rather than a detach handle. Use with the detach
|
|
|
34 |
category prefix.
|
|
|
35 |
- The type parameter can be an object containing multiple events to attach
|
|
|
36 |
Y.on( { 'event1': fn1, 'event2': fn2 }
|
|
|
37 |
- Y.fire payload for event facades can be another facade or a custom event.
|