Global events manager
CSS JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bower_components
docs
src
test
.gitignore
.travis.yml
README.md
bower.json
dispatch.js
gulpfile.js
package.json

README.md

dispatch

Global event manager, pub/sub implementation

Usage

dispatch.on('newEvent', function(data){
  alert(data.message);
});

dispatch.trigger('newEvent', { message: 'Thug Life' });

dispatch.off('newEvent');

Demo

Check it out

Methods

dispatch.on(Event Name, Callback Method)

Creates new global event binding

Params:

  • string Event Name

  • function Callback Method

dispatch.off(Event Name)

Removes global event binding

Params:

  • string Event Name

dispatch.trigger(Event Name,Data Object)

Triggers global event

Params:

  • string Event Name

  • object Data Object