Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
famous-mediator
Advanced tools
A design pattern that decouples modules using the mediator pattern.
Install using bower or npm
bower install famous-mediator
npm install famous-mediator
Imagine you have a Router
module and a pages
module:
1. Router.js - does it's thing and doesn't know about other modules
function Router(){
// blablabla
this.name = 'router';
Engine.emit('created',this) // broadcast created event
// blablabla
}
2. PageController.js - displays pages but doesn't know about any routes!
function PageController(){
// blablabla
this.name = 'pages'; // name your module
Engine.emit('created',this) // broadcast created event
// blablabla
}
3. RouteMediator.js - couples the router and pages together!
var Mediator = require('famous-mediator');;
Mediator.on('created:Router',function(router){
router.on('change',function(name){
Mediator.pages.setPage(name);
});
});
Using the mediator pattern to decouple modules
The Famo.us Engine is used as a global eventbus to announce creation of modules. If you want to register a module, simple call in your constructor function:
Engine.emit('created',this)
A module MUST have a name to be registered. This name can be found on:
The module with the name xxxx
is accessible as follows:
var Mediator = require('famous-mediator');
Mediator.xxxx
Mediator.on('created:xxxx',function(xxxx){ .... });
The idea is to write Mediator singletons that couple modules together by:
Mediator.on
to Engine.on
.Feel free to contribute to this project in any way. The easiest way to support this project is by giving it a star.
© 2014 - Mark Marijnissen
FAQs
Utilities for a mediator design pattern in Famo.us
We found that famous-mediator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.