包详细信息

events-light

Lightweight and fast implementation of the 'events' module for the browser and server.

EventEmitter, events, tiny

自述文件

events-light

This is a lighter and small version of the builtin Node.js events with some removals, but no additional features. This module was designed to be a trimmed down polyfill for the events module in the browser, but it can also be used on the server.

Install

npm install events-light --save

Usage

var EventEmitter = require('events-light');

var myEventEmitter = new EventEmitter();

myEventEmitter.on('hello', function(name) {
    console.log('Hello ' + name);
});

myEventEmitter.emit('hello', 'World');

Difference from the Node.js events module

License

MIT