events-light

2018-11-08 admin

events-light是什么

什么是events-light,Lightweight and fast implementation of the 'events' module for the browser and server.

events-light使用教程帮助文档

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

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-44883.html

文章标题:events-light

回到顶部