Skip to content
Global events manager
CSS JavaScript
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
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

You can’t perform that action at this time.