Class: CEventDispatcher
Basic class of event diapatcher. It includes the implementation of functions such as event registration, deregistration, distribution, and unregister.
Hierarchy
CEventDispatcher
↳
Entity
↳
DDGIIrradianceGPUBufferReader
↳
PickFire
Constructors
Methods
- dispatchEvent
- destroy
- addEventListener
- removeEventListener
- removeEventListenerAt
- removeAllEventListener
- containEventListener
- hasEventListener
Constructors
constructor
• new CEventDispatcher(): CEventDispatcher
Returns
Methods
dispatchEvent
▸ dispatchEvent(event
): void
Dispatch an event to all registered objects with a specific type of listener.
Parameters
Name | Type |
---|---|
event | CEvent |
Returns
void
Defined in
src/event/CEventDispatcher.ts:24
destroy
▸ destroy(): void
release all registered event.
Returns
void
Defined in
src/event/CEventDispatcher.ts:55
addEventListener
▸ addEventListener(type
, callback
, thisObject
, param?
, priority?
): number
register an event listener to event distancher.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
type | string | number | undefined | {string} event type. |
callback | Function | undefined | {Function} The callback function that handles events. This function must accept an Event3D object as its unique parameter and cannot return any result. for example: function(evt:Event3D):void. |
thisObject | any | undefined | {any} Current registration object, it'll call callback function. |
param | any | null | {any} the data binded to registered event, the default value is null. |
priority | number | 0 | {number} The priority of callback function execution, with a larger set value having priority to call |
Returns
number
Returns register event id
Defined in
src/event/CEventDispatcher.ts:79
removeEventListener
▸ removeEventListener(type
, callback
, thisObject
): void
Remove Event Listening
Parameters
Name | Type | Description |
---|---|---|
type | string | number | {string} event type |
callback | Function | {Function} callback function of event register |
thisObject | any | {any} The current registered object. |
Returns
void
Defined in
src/event/CEventDispatcher.ts:113
removeEventListenerAt
▸ removeEventListenerAt(id
): boolean
Remove an event Listening with id
Parameters
Name | Type |
---|---|
id | number |
Returns
boolean
Defined in
src/event/CEventDispatcher.ts:133
removeAllEventListener
▸ removeAllEventListener(eventType?
): void
Specify a event type to remove all related event listeners eventType event type, set null to remove all event listeners
Parameters
Name | Type | Default value |
---|---|---|
eventType | string | number | null |
Returns
void
Defined in
src/event/CEventDispatcher.ts:153
containEventListener
▸ containEventListener(type
): boolean
whether the target presence of a listener with event type.
Parameters
Name | Type | Description |
---|---|---|
type | string | {string} event type. |
Returns
boolean
Returns a boolean.
Defined in
src/event/CEventDispatcher.ts:185
hasEventListener
▸ hasEventListener(type
, callback?
, thisObject?
): boolean
whether the target presence of a listener with event type. it associate more registration parameters.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
type | string | number | undefined | {string} event name. |
callback | Function | null | {Function} callback function of event register. |
thisObject | any | null | {any} The registered object. |
Returns
boolean
Returns a boolean.