akamai.amp~EventDispatcher
Creates a new EventDispatcher
Constructor
EventDispatcher
new EventDispatcher(targetopt)
Create an EventDispatcher
Parameters
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
target |
Object |
<optional> |
this | The default event target. |
Methods
addEventListener
addEventListener(typenon-null, funcnon-null)
Adds a listener for a given event type.
Parameters
Name | Type | Description |
---|---|---|
type |
string | A string representing the event's type. |
func |
function | A function to call when the event is triggered. |
addListener
addListener()
Alias of addEventListener
destroy
destroy()
Destroys the EventDispatcher
dispatch
dispatch(type, detailopt)
Dispathes and event, triggering all event listener of the event's type.
Parameters
Name | Type | Attributes | Description |
---|---|---|---|
type |
string | The event to type. |
|
detail |
Object |
<optional> |
Object representing event specific details. |
dispatchEvent
dispatchEvent(eventnon-null)
Dispathes and event, triggering all event listener of the event's type.
Parameters
Name | Type | Description |
---|---|---|
event |
Event | The event to dispatch. |
emit
emit()
Alias of dispatch
off
off()
Alias of removeEventListener
on
on()
Alias of addEventListener
once
once(typenon-null, funcnon-null)
Adds a listener for a given event type that is called once, then removed.
Parameters
Name | Type | Description |
---|---|---|
type |
string | A string representing the event's type. |
func |
function | A function to call when the event is triggered. |
removeEventListener
removeEventListener(typenon-null, funcnon-null) → (nullable) {function}
Removes a listener for a given event type.
Parameters
Name | Type | Description |
---|---|---|
type |
string | A string representing the event's type. |
func |
function | A function to call when the event is triggered. |
Returns
- function
-
the handler that was removed if any
removeListener
removeListener()
Alias of removeEventListener