Skip to content

Shalimov/jsmediator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DOC IN PROGRESS

Pls, look at the tests for examples

global : object

Kind: global namespace

new Mediator(eventEmitter, setting)

Mediator - Provide ability to you create a simple mediator to control interaction among components based on low coupling

Param Type
eventEmitter EventEmitter
setting Object

mediator.addComponent(name, registrator)

Method provides ability to add component

Kind: instance method of Mediator

Param Type
name string
registrator function

mediator.removeComponent(name) ⇒ boolean

Method removes existing component, unattached event handlers for component and remove dependencies

Kind: instance method of Mediator
Returns: boolean - True if component was removed in opposite false

Param Type Description
name string Component Name

mediator.hasComponent(name) ⇒ boolean

Method provides you ability to check component existence by name

Kind: instance method of Mediator

Param Type
name string

mediator.getComponent(name) ⇒ Object

Method provides component by name

Kind: instance method of Mediator

Param Type
name string

mediator.componentsList() ⇒ Array

Method provides components' names list for all registered components

Kind: instance method of Mediator
Returns: Array - Array that contains string names of each registered component

mediator.shareResponsibility(mediator)

Method can be used if you want to share events among several mediators in application

Kind: instance method of Mediator

Param Type
mediator Mediator

mediator.toString() ⇒ string

Return string for Instance of Mediator [object Mediator]

Kind: instance method of Mediator

Mediator.EVENTS

Kind: static constant of Mediator

EVENTS.ADD

Event with this name is emitted every time when new component is registered in system

Kind: static constant of EVENTS

EVENTS.REMOVE

Event with this name is emitted every time when component is removed in system

Kind: static constant of EVENTS

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published