Git Product home page Git Product logo

raincatcher-mediator's Introduction

FeedHenry WFM mediator

An implementation of the mediator pattern for use with WFM modules.

API

Method Description
mediator#publish( channel, [data] ) Publish data to a channel
mediator#subscribe( channel, callback ) Subscribe to events in a channel
mediator#remove( channel, [identifier] ) Unsubscribe to events in a channel
mediator#once( channel, callback ) A one-time subscribtion to events in a channel
mediator#promise( channel ) A promise-based API for mediator#once

Usage in an Angular.js client

API

Besides the above operations, the current operations are available :

Method Description
mediator#subscribeForScope( channel, scope, callback ) Subscribe to events in a channel and unsubscribe when the scope is destroyed

Setup

This module is packaged in a CommonJS format, exporting the name of the Angular namespace. The module can be included in an angular.js as follows:

angular.module('app', [
, require('fh-wfm-mediator')
...
])

Integration

Inject the mediator service to broadcast and subscribe to events

.controller('MyController', function (mediator) {
  ...
}

Usage in an node.js backend

Require the module to get an instance of the mediator. Be sure to use that same instance throughout the application to maintain a single list of subscribers.

mediator = require('fh-wfm-mediator/lib/mediator')

raincatcher-mediator's People

Contributors

bleathem avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.