class EventListener view source

A base class to support eventing

Constructor

new EventListener()

Instance members

emit(type : string, arguments… : any)

Emit an event

Parameters

type string event type to emit
arguments any arguments (excluding type) will be set in event.data

isDestroyed() : (boolean)

Returns if the node is destroyed

Returns

(boolean) true if node is destroyed

when(type : string, handler : Hook, once : boolean) : (HandleRegistration)

Registers a handler for this event type

Parameters

type string event type (e.g. "attribute changed")
handler Hook handler to trigger when the event type is emitted
once boolean if true, will only fire once

Returns

(HandleRegistration) a registration handle (for unbind purpose)