new Target()
An object which can dispatch Guacamole.Event objects. Listeners
registered with on() will automatically
be invoked based on the type of Guacamole.Event passed to
dispatch(). It is normally
subclasses of Guacamole.Event.Target that will dispatch events, and usages
of those subclasses that will catch dispatched events with on().
- Source:
Methods
dispatch(eventnon-null)
Dispatches the given event, invoking all event handlers registered with
this Guacamole.Event.Target for that event's
type.
Parameters:
Name | Type | Description |
---|---|---|
event |
Guacamole.Event | The event to dispatch. |
- Source:
off(typenon-null, listenernon-null) → (non-null) {boolean}
Unregisters a listener that was previously registered with
on() or
onEach(). If no such listener was
registered, this function has no effect. If multiple copies of the same
listener were registered, the first listener still registered will be
removed.
Parameters:
Name | Type | Description |
---|---|---|
type |
string | The unique name of the event type handled by the listener being removed. |
listener |
Guacamole.Event.Target~listener | The listener function previously provided to on()or onEach(). |
- Source:
Returns:
true if the specified listener was removed, false otherwise.
- Type
- boolean
offEach(typesnon-null, listenernon-null) → (non-null) {boolean}
Unregisters listeners that were previously registered with
on() or
onEach(). If no such listeners
were registered, this function has no effect. If multiple copies of the
same listener were registered for the same event type, the first
listener still registered will be removed.
Invoking this function is equivalent to manually invoking off() for each of the provided types.
Parameters:
Name | Type | Description |
---|---|---|
types |
Array.<string> | The unique names of the event types handled by the listeners being removed. |
listener |
Guacamole.Event.Target~listener | The listener function previously provided to on() or onEach(). |
- Source:
Returns:
true if any of the specified listeners were removed, false
otherwise.
- Type
- boolean
on(typenon-null, listenernon-null)
Registers a listener for events having the given type, as dictated by
the type property of Guacamole.Event
provided to dispatch().
Parameters:
Name | Type | Description |
---|---|---|
type |
string | The unique name of this event type. |
listener |
Guacamole.Event.Target~listener | The function to invoke when an event having the given type is dispatched. The Guacamole.Event object provided to dispatch() will be passed to this function, along with the dispatching Guacamole.Event.Target. |
- Source:
onEach(typesnon-null, listenernon-null)
Registers a listener for events having the given types, as dictated by
the type property of Guacamole.Event
provided to dispatch().
Invoking this function is equivalent to manually invoking on() for each of the provided types.
Parameters:
Name | Type | Description |
---|---|---|
types |
Array.<string> | The unique names of the event types to associate with the given listener. |
listener |
Guacamole.Event.Target~listener | The function to invoke when an event having any of the given types is dispatched. The Guacamole.Event object provided to dispatch() will be passed to this function, along with the dispatching Guacamole.Event.Target. |
- Source:
Type Definitions
listener(eventnon-null, targetnon-null)
A callback function which handles an event dispatched by an event
target.
Parameters:
Name | Type | Description |
---|---|---|
event |
Guacamole.Event | The event that was dispatched. |
target |
Guacamole.Event.Target | The object that dispatched the event. |
- Source: