Skip to content

isabella232/events-9

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

events

Node's events module in the browser.

This is a wrapper around component/emitter that is api-compatible with node's events module. It also is a fork of juliangruber/events that adds uses node.js events when running on the server.

Events Node.js v0.8.11 Manual & Documentation

Installation

Install with component(1)

$ component install intesso/events

Usage example

node.js events api:

var EventEmitter = require('events').EventEmitter;
var ee = new EventEmitter();

ee.on('foo', function(data) {
  console.log('foo received', data);
})

ee.emit('foo', 'bar');
// -> 'foo received bar'

Another example with the component-emitter api:

function Obj() {
  this.name = "Obj";
}

var Events = require('events');
Events(Obj.prototype);

obj = new Obj();

obj.addListener('foo', function(data) {
  console.log('foo received', data);
})

obj.emit('foo', 'bar');
// -> 'foo received bar'

License

(MIT)

About

Node's events module in the browser

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%