import LifecyclePlugin from 'phaser-lifecycle-plugin/src/phaser-lifecycle-plugin.js'
LifecyclePlugin
Extends:
Plugin that wraps around Phaser's event system. This allows us to avoid the issues around the EventEmitter library Phaser uses where the EE caches the listeners at the start of an event. This leads to bugs if a listener gets unsubscribed during an event (e.g. the physics system unsubscribing a listener via a CB before the listener's update method). This plugin immediately unsubscribes the listener.
Constructor Summary
Public Constructor | ||
public |
|
Member Summary
Public Members | ||
public |
eventHandlers: {} |
|
public |
eventNames: * |
|
public |
|
|
public |
listeners: {} |
|
public |
|
|
public |
scene: * |
|
public |
systems: * |
Method Summary
Public Methods | ||
public |
add(object: *, eventMapping: *) |
|
public |
boot() |
|
public |
destroy() |
|
public |
onSceneEvent(eventName: *, args: ...*) |
|
public |
remove(object: *) |
|
public |
|
|
public |
setEventsToTrack(camelCaseEvents: *) |
|
public |
shutdown() |
|
public |
start() |
|
public |
|
|
public |
|
Public Constructors
public constructor() source
Public Members
public eventHandlers: {} source
public eventNames: * source
public listeners: {} source
public possibleMethodNames: * source
public scene: * source
public systems: * source
Public Methods
public add(object: *, eventMapping: *) source
Params:
Name | Type | Attribute | Description |
object | * | ||
eventMapping | * |
public boot() source
public destroy() source
public onSceneEvent(eventName: *, args: ...*) source
Params:
Name | Type | Attribute | Description |
eventName | * | ||
args | ...* |
public remove(object: *) source
Params:
Name | Type | Attribute | Description |
object | * |
public removeAll() source
public setEventsToTrack(camelCaseEvents: *) source
Params:
Name | Type | Attribute | Description |
camelCaseEvents | * |