Global events manager
CSS JavaScript
Permalink
Failed to load latest commit information.
bower_components Initial commit Feb 22, 2014
docs Adding tests to gulp watch Feb 23, 2014
src Its Gulp Time Feb 23, 2014
test Headless testing & Travis CI Feb 23, 2014
.gitignore gitignore Feb 23, 2014
.travis.yml Headless testing & Travis CI Feb 23, 2014
README.md demo link Feb 23, 2014
bower.json bower Feb 23, 2014
dispatch.js Its Gulp Time Feb 23, 2014
gulpfile.js Adding tests to gulp watch Feb 23, 2014
package.json Its Gulp Time Feb 23, 2014

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