eventhandler.js
v0.2.0
Published
![Bower version](https://img.shields.io/bower/v/EventHandler.js.svg) [![npm version](https://img.shields.io/npm/v/eventhandler.js.svg)](https://www.npmjs.com/package/eventhandler.js) [![Build Status](https://travis-ci.org/murrayju/EventHandler.js.svg?bran
Downloads
3
Readme
EventHandler.js
A simple class for handling events
Quick start
Several options are available to get started:
- Download the latest release.
- Clone the repo:
git clone https://github.com/murrayju/EventHandler.js.git
. - Install with Bower:
bower install EventHandler.js
. - Install with npm:
npm install eventhandler.js
.
Example
var evt = new EventHandler();
// Register a listener for this event
var handler = evt.on(function (someArg) {
console.log('Event fired with arg: ' + someArg);
});
// Fire the event
evt.fire('test data');
// Unregister the listener when no longer needed
handler.off();
Credits
A big thanks to BrowserStack for providing automated cross-browser testing!