new LifeCycleManager()
LifeCycleManager which goes as a dependendecy to a muze
it accepts notification from the entire library throughout
the exeecution life
Classes
Methods
(static) _boot()
Fills all the notifiers with resolver callback
(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 |
(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 |
(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` |
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
|
(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
(static) _releasePromisesFromCache()
Try to clear the cached promsies once we have
macthed callbacks from the user
(static) _resetTargetPromise(eventName)
Reset the promise into pending state
Parameters:
Name | Type | Description |
---|---|---|
eventName |
string | name of the event happening |
(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
|
(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
|
(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 |
(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` |
Returns:
promise that is passed to the user
- Type
- promise