urban-emitter
Simple implementation of an event emitter.
Last updated 2 years ago by jesselylemull .
UNLICENSED · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install urban-emitter 
SYNC missed versions from official npm registry.

Urban-Emitter

This is a simple event emitter implementation.

Installation:

Node.js, browserify, and webpack users can install via npm:
npm install --save-dev urban-emitter

Available at github and npm repository.

Testing:

npm test

Documentation:

JSDoc documentation is housed in the doc folder.

Usage:

// Create an event emitter

var UrbanEmitter = require('urban-emitter');

var emitter = new UrbanEmitter();

var fxn = function(element) {
   // Do something awesome...
}

// Adds a handler that can be invoked more than once

emitter.add('onclick', fxn);

// Adds a handler that is invoked only once

emitter.once('onchange', fxn);

// Invokes all handlers for the event passing them all other arguments

emitter.emit('onclick', args);

// Removes/clears the handlers

emitter.remove('onclick', fxn);
emitter.clear();

Current Tags

  • 2.0.2                                ...           latest (2 years ago)

3 Versions

  • 2.0.2                                ...           2 years ago
  • 2.0.1                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 2
Last Day 0
Last Week 0
Last Month 3
Dependencies (3)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |