3vent 中文文档教程
MinEvent
Node.js 的类似 EventEmitter 的非常轻的功能
提供类似于 EventEmitter 的接口。
$ npm i --save 3vent
Example
const EventEmitter = require('3vent')
class Dude extends EventEmitter {
constructor () {
super()
}
test (name) {
this.emit('msg', name)
}
}
const bob = new Dude()
bob.on('msg', msg => console.log('message:', msg))
bob.test('sup') // logs "message: sup"
MinEvent
Very light EventEmitter-like functionality for Node.js
Provides an interface that is similar to an EventEmitter.
$ npm i --save 3vent
Example
const EventEmitter = require('3vent')
class Dude extends EventEmitter {
constructor () {
super()
}
test (name) {
this.emit('msg', name)
}
}
const bob = new Dude()
bob.on('msg', msg => console.log('message:', msg))
bob.test('sup') // logs "message: sup"