doodle.createEmitter
Description:
- Emitter () :Emitter
-
Inherits
- Object
Returns
- Emitter –
Methods
- on (type:string, listener:Function) :void
-
Adds an event listener on an Emitter object. This is convenience alias for Emitter.addListener(type, listener, useCapture=false).
Parameters
- type:string –
- listener:Function –
Throws
- TypeError –
- once (type:string, listener:Function) :void
-
Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed.
Parameters
- type:string –
- listener:Function –
Throws
- TypeError –
- willTrigger (type:string) :boolean
-
Checks whether an event listener is registered with this Emitter object or any of its ancestors for the specified event type. The difference between the hasListener() and the willTrigger() methods is that hasListener() examines only the object to which it belongs, whereas the willTrigger() method examines the entire event flow for the event specified by the type parameter.
Parameters
- type:string – The type of event.
Returns
- boolean –
Throws
- TypeError –
- hasListener (type:string) :boolean
-
Checks whether the Emitter object has any listeners registered for a specific type of event.
Parameters
- type:string –
Returns
- boolean –
Throws
- TypeError –
- emit (event:doodle.events.Event) :boolean
-
Dispatches an event into the event flow. The event target is the Emitter object upon which the emit() method is called.
Parameters
- event:doodle.events.Event –
Returns
- boolean – true if the event was successfully dispatched.
Throws
- TypeError –
- broadcast (event:doodle.events.Event) :boolean
-
Dispatches an event to every object with an active listener. Ignores propagation path, objects come from
Parameters
- event:doodle.events.Event –
Returns
- boolean – True if the event was successfully dispatched.
Throws
- TypeError –
- Error –
- handleEvent (event:doodle.events.Event) :boolean
-
Lookup and call listener if registered for specific event type.
Parameters
- event:doodle.events.Event –
Returns
- boolean – true if node has listeners of event type.
Throws
- TypeError –
- addListener (type:string, listener:Function) :void
-
Registers an event listener object with an Emitter object so that the listener receives notification of an event.
Parameters
- type:string –
- listener:Function –
Throws
- TypeError –
- removeListener (type:string, listener:Function) :void
-
Removes a listener from the Emitter object.
Parameters
- type:string –
- listener:Function –
Throws
- TypeError –
- removeAllListeners (type:string) :void
-
Removes all listeners from the Emitter for the specified event.
Parameters
- type:string –
Throws
- TypeError –
- listeners (type:string) :array
-
Returns an array of listeners for the specified event.
Parameters
- type:string –
Returns
- array –
- toString () :string
-
Returns the string representation of the specified object.
Returns
- string –
Class Functions
- isEmitter (obj:Object) :boolean
-
Test if an object is an event emitter.
Parameters
- obj:Object –
Returns
- boolean –