Class: LifeCycleManager

LifeCycleManager()

new LifeCycleManager()

LifeCycleManager which goes as a dependendecy to a muze it accepts notification from the entire library throughout the exeecution life
Source:

Classes

module.exports

Methods

(static) _boot()

Fills all the notifiers with resolver callback
Source:

(static) _cachePromise(composition, stage, promise)

Cache the promise in the map. This cache then get consumed if we get user callbacks
Parameters:
Name Type Description
composition string name of the compositon like `canvas`
stage string the stage name when the event happened like `beforedraw`
promise promise promise that is passed to the user
Source:

(static) _callLifeCycleCallback(composition, stage, promise)

Calls the user's callback with callback
Parameters:
Name Type Description
composition string name of the compositon like `canvas`
stage string the stage name when the event happened like `beforedraw`
promise promise promise that is passed to the user
Source:

(static) _makeNotifierPromise(eventName) → {promise}

Creates a promise that will be passed to user's callback
Parameters:
Name Type Description
eventName string name of the event like `canvas.drawn`
Source:
Returns:
a pending promise waiting for resolve to be called
Type
promise

(static) _notify(composition, notification)

Notify user the with promsie in a callback if callback not found then cache it
Parameters:
Name Type Description
composition string
notification Object notification object
Properties
Name Type Description
formalName string name of the sender creating the notification
client Object instance or array of instances sending the notification
action string the stage name when the event happened like `beforedraw`
Source:

(static) _preparePromises()

Prepares the promise map with pending promises all the promises are in a pending state where their's resolve function waiting to be called with notification object
Source:

(static) _releasePromisesFromCache()

Try to clear the cached promsies once we have macthed callbacks from the user
Source:

(static) _resetTargetPromise(eventName)

Reset the promise into pending state
Parameters:
Name Type Description
eventName string name of the event happening
Source:

(static) _resolvePromise(eventName, notification)

Resolves the promise with notification object
Parameters:
Name Type Description
eventName string name of the event in the system
notification Object notification object
Properties
Name Type Description
formalName string name of the sender creating the notification
client Object instance or array of instances sending the notification
action string the stage name when the event happened like `beforedraw`
Source:

(static) notify(notification)

Public method which is being called by different subcompoents of the system at different execution atages
Parameters:
Name Type Description
notification Object notification object
Properties
Name Type Description
formalName string name of the sender creating the notification
client Object instance or array of instances sending the notification
action string the stage name when the event happened like `beforedraw`
Source:

(static) register(lifeCyclesopt)

It register's the callbacks gievn the user
Parameters:
Name Type Attributes Default Description
lifeCycles Object <optional>
{} a object with list of callbacks
Source:

(static) retrieve(eventName) → {promise}

Public method which gives the promise corresponding to the event name
Parameters:
Name Type Description
eventName string name of the event like `canvas.drawn`
Source:
Returns:
promise that is passed to the user
Type
promise