Emitter
Event emitter implementation using the “frozen closure” pattern as described by Douglas Crockford. Heavily inspired by component/emitter.
Browser support: ES5 compatible browsers (IE9+)
Installation
npm install maxhoffmann/emitter --save
Usage
var Emitter = ; var emitter = ; emitter;emitter; // only listen once emitter; // remove specific listeneremitter; // remove all listeners of this eventemitter; // remove all listeners emitter; // arguments are optional emitter;emitter; // returns true if any listeners are added
Note: This library is built with webpack to the UMD format. You can therefore use it with common.js and amd loaders or as a global variable.
Testing
cd
into directory- run
npm test
Development
npm run build
to create a minimized and UMD format compatible version of the source file.
LICENSE
The MIT License