Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

famous-mediator

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

famous-mediator

Utilities for a mediator design pattern in Famo.us

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

famous-mediator

A design pattern that decouples modules using the mediator pattern.

Getting started

Install using bower or npm

  bower install famous-mediator
  npm install famous-mediator

Usage

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:

  • this.options.id = 'xxxx'
  • this.options.name = 'xxxx'
  • this.id = 'xxxx'
  • this.name = 'xxxx'

The module with the name xxxx is accessible as follows:

  var Mediator = require('famous-mediator');
  Mediator.xxxx
  Engine.on('created:xxxx',function(xxxx){ .... });

The idea is to write Mediator singletons that couple modules together by:

  • listening to the events they emit
  • calling the public API
  • triggering events on a module

For example, imagine you have a Router module and a pages module:

  var Mediator = require('famous-mediator');
  var Engine = require('famous/core/Engine');

  Engine.on('created:Router',function(router){
    router.on('change',function(name){
      Mediator.pages.set(name);
    });
  });

Contribute

Feel free to contribute to this project in any way. The easiest way to support this project is by giving it a star.

Contact

  • @markmarijnissen
  • http://www.madebymark.nl
  • info@madebymark.nl

© 2014 - Mark Marijnissen

Keywords

FAQs

Package last updated on 14 Oct 2014

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc