The CustomEvent class lets you define events for your application that can be subscribed to by one or more independent component.
_broadcastargs
Notifies the YUI instance if the event is configured with broadcast = 1, and both the YUI instance and Y.Global if configured with broadcast = 2.
args
Array
Arguments sent to fire()
_deletesubscriber
Deletes the subscriber from the internal store of on() and after() subscribers.
subscriber
Object
object.
_notifys
args
Notify a single subscriber
s
Subscriber
the subscriber.
args
Array
the arguments array to apply to the listener.
_onfn
[context]
[args]
[when]
Create the Subscription for subscribing function, context, and bound arguments. If this is a fireOnce event, the subscriber is immediately notified.
_procSubssubs
args
ef
Notifies a list of subscribers.
afterfn
context
arg
Listen for this event after the normal subscribers have been notified and the default behavior has been applied. If a normal subscriber prevents the default behavior, it also prevents after listeners from firing.
applyConfigo
force
Apply configuration properties. Only applies the CONFIG whitelist
detachfn
context
Detach listeners.
detachAllRemoves all listeners
firearguments
Notifies the subscribers. The callback functions will be executed from the context specified when the event was created, and with the following parameters:
arguments
Object*
an arbitrary set of parameters to pass to the handler.
fireSimpleargs
Set up for notifying subscribers of non-emitFacade events.
args
Array
Arguments passed to fire()
getSubsGet all of the subscribers to this event and any sibling event
haltimmediate
Stops the event propagation and prevents the default event behavior.
immediate
Boolean
if true additional listeners on the current target will not be executed
hasSubsReturns the number of subscribers for this event as the sum of the on() subscribers and after() subscribers.
logmsg
cat
Logger abstraction to centralize the application of the silent flag
monitorwhat
Monitor the event state for the subscribed event. The first parameter is what should be monitored, the rest are the normal parameters when subscribing to an event.
what
String
what to monitor ('detach', 'attach', 'publish').
onfn
context
arg
Listen for this event
preventDefaultPrevents the execution of this event's defaultFn
stopImmediatePropagationStops propagation to bubble targets, and prevents any remaining subscribers on the current target from executing.
stopPropagationStop propagation to bubble targets
subscribefn
Listen for this event
fn
Function
The function to execute.
unsubscribefn
context
Detach listeners.
unsubscribeAllRemoves all listeners
broadcastIf 0, this event does not broadcast. If 1, the YUI instance is notified every time this event fires. If 2, the YUI instance and the YUI global (if event is enabled on the global) are notified every time this event fires.
bubblesSpecifies whether or not a subscriber can stop the event propagation via stopPropagation(), stopImmediatePropagation(), or halt()
Events can only bubble if emitFacade is true.
Default: true
defaultFnThe default function to execute after event listeners have fire, but only if the default action was not prevented.
emitFacadeIf set to true, the custom event will deliver an EventFacade object that is similar to a DOM event object.
Default: false
fireOnceThis event should only fire one time if true, and if it has fired, any new subscribers should be notified immediately.
Default: false;
preventableSpecifies whether or not this event's default function can be cancelled by a subscriber by executing preventDefault() on the event facade
Default: true
preventedFlag for preventDefault that is modified during fire(). if it is not 0, the default behavior for this event
queuableSpecifies whether this event should be queued when the host is actively processing an event. This will effect exectution order of the callbacks for the various events.
Default: false
signatureSupports multiple options for listener signatures in order to port YUI 2 apps.
Default: 9
silentBy default all custom events are logged in the debug build, set silent to true to disable debug outpu for this event.
stoppedFlag for stopPropagation that is modified during fire() 1 means to stop propagation to bubble targets. 2 means to also stop additional subscribers on this target.
stoppedFnThe function to execute if a subscriber calls stopPropagation or stopImmediatePropagation