Members
destroyInstance :destroyModuleInstance
Deprecating destroyModuleInstance for name consistency
Type:
eventQ :Object
Type:
- Object
- Source:
isBrowser :boolean
{@todo reserved for future use}
Type:
- boolean
- Source:
isServer :boolean
{@todo reserved for future use}
Type:
- boolean
- Source:
(private, constant) lifeCycleFlags :Object
following fields
- booted: true
- rendered: false
- preRenderResolved: false
Type:
- Object
- Source:
(constant) PubSubHelper :PubSub
exported the Pub Sub Helper It sis not recommended to use pub sub helper directly. More helpful to use in case of creating Providers.
Type:
- PubSub
subscriptions
To be used by pubsub {Object} List of all the subscriptions of all the events. Present in the format {"eventName": {subscription object}}
- Source:
Methods
(private) _callRender(module, placeholderResponse) → {Promise}
Renders the module by calling Module.createModuleArena Changes the life cycle flag to rendered thereafter.
Parameters:
| Name | Type | Description |
|---|---|---|
module |
Module | to be rendered. |
placeholderResponse |
Returns:
- Type
- Promise
(private) _callResolveRenderOn(module, data)
Parameters:
| Name | Type | Description |
|---|---|---|
module |
Module | to be rendered. |
data |
* | the data to be passed to module while initialization Calls Module.resolveRenderOn method . This method is passed from the config for the module and after resolveRenderOn is resolved, lifecycle status is changed to "preRenderResolved". The resolveRenderOn should return {Promise} |
(private) _emitLifeCycleEvent(moduleDetail, eventName)
Publishes the event when state of the module changes
Parameters:
| Name | Type | Description |
|---|---|---|
moduleDetail |
[object] module |
|
eventName |
[string] |
(private) _listenForInitOn() → {Promise}
This function resolves the Promise if initOn is true and module is already rendered. Refer lifeCycleFlags for initial lifecycle values. Calls _callResolveRenderOn if either case fails
Parameters:
| Name | Type | Description |
|---|---|---|
module. |
Module | The module to be rendered. |
Returns:
- Type
- Promise
(private) _lockEvents(module, placeholderResponse)
Subscribes to all the events of type playAfterRender
Parameters:
| Name | Type | Description |
|---|---|---|
module |
Module | to be rendered. |
placeholderResponse |
(private) _onBreath(module, eventName)
Parameters:
| Name | Type | Description |
|---|---|---|
module |
[Object] Blinx module |
|
eventName |
[string] |
(private) _registerModule(config, moduleNameopt, instanceopt, instanceConfigopt, pathopt)
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
config |
Object | The configuration of the module to be created. Creates instance of Module and keeps it in Store.If the module has child modules then the child modules too will be registered. It must contain following properties
If the module has already been registered on the same path then registration would be skipped and a warning will be generated. |
||
moduleName |
String |
<optional> |
config.moduleName | The unique name in the workspace of the module |
instance |
Object |
<optional> |
config.module | |
instanceConfig |
Object |
<optional> |
config.instanceConfig | |
path |
String |
<optional> |
"" |
(private) _registerSubscription(module) → {*}
Parameters:
| Name | Type | Description |
|---|---|---|
module |
Module | The Module generated by _registerModule. If the module listens to any event or if the module is instantiated based on an event then module is made to subscribe all the events. initOn will have following properties
listensTo {array} this is an array of objects (the events) to which the module subscribes
|
Returns:
- Type
- *
(private) _startExec(patchModules, promiseArr)
Called after the module is registered. Responsible for rendering the module. The rendering will wait till the event occurs if initOn option is provided.
This method contains four steps
- call resolveRenderOn method and wait for the promise to be resolved (_callResolveRenderOn)
- subscribe to the events of type "playAfterRender"
- Render the module
Parameters:
| Name | Type | Description |
|---|---|---|
patchModules |
Array | The array of modules to be rendered. Initially list is taken from moduleS |
promiseArr |
Array | the array of promise objects |
attachListener()
Created by anoof.shaikh on 03/01/17.
- Source:
checkIfModuleHasInitOn(moduleContext, EventName)
Check if the module has initOn
Parameters:
| Name | Type | Description |
|---|---|---|
moduleContext |
Object | the moduleContext object |
EventName |
String |
- Source:
createInstance(config) → {Promise|undefined}
Parameters:
| Name | Type | Description |
|---|---|---|
config |
Object | The configuration of the module to be created. It must contain following properties
|
Returns:
Resolves when all the modules are rendered.
- Type
- Promise | undefined
deleteInstance(id)
deletes the instance of the module. Removes the entry from the module store instance of Module
Parameters:
| Name | Type | Description |
|---|---|---|
id |
- Source:
destroyModuleInstance(module, contextopt) → {boolean}
Destroys the module . Does the following
- removed DOM element
- Unsubscribes events.It calls Module.unsubscribe
- Removes the entry of module from module store
- Removes the entry of child modules from module store
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
module |
Array | Object | The module to be destroyed |
||
context |
object |
<optional> |
window | @todo . Reserved for future enhancement |
Returns:
true when module gets deleted successfully
- Type
- boolean
findInstance(name) → {Array}
Finds all the instances of the module from the module store
Parameters:
| Name | Type | Description |
|---|---|---|
name |
of the module to be searched |
- Source:
Returns:
of all the instances of the module
- Type
- Array
insertInstance(instance)
inserts the instance into the module store
Parameters:
| Name | Type | Description |
|---|---|---|
instance |
of Module |
- Source:
isGlobalPubsub(instance)
Check if the event is subscribed or published using global pubsub
Parameters:
| Name | Type | Description |
|---|---|---|
instance |
Object | the instance object using which the pub sub is handled |
- Source:
isModuleRendered(moduleContext)
Check if the module is rendered
Parameters:
| Name | Type | Description |
|---|---|---|
moduleContext |
Object | the moduleContext object |
- Source:
use(middleware)
The middlewares are the additional functionalities that you can create in blinx. These are providers which enhances the basic functionalities. You can create your own provider too. The provider is generally in format export default function (module) { return { render: function(){ //your overridden logic } } } where module is the instance of the module passed evrytime a new instance is created and any of the default methods provided by the blinx can be overridden here example render
Parameters:
| Name | Type | Description |
|---|---|---|
middleware |