【文件属性】:
文件名称:eventmit:简单的EventEmitter。 每个事件一个事件对象
文件大小:79KB
文件格式:ZIP
更新时间:2021-05-24 13:29:08
nodejs events browser pubsub eventemitter
事件
每个事件一个事件对象。
特征
每个事件一个事件对象
微小的代码库-少1kb
由TypeScript撰写
安装
使用安装:
npm install eventmit
要求:ECMAScript 2015,因为此库使用 。
用法
创建一个事件提交对象并注册处理程序并调用处理程序。
import { eventmit } from "eventmit" ;
const event = eventmit < { key : string } > ( ) ;
// Register handler
event . on ( ( value ) => {
console . log ( 1 , value ) ;
} ) ;
event . on ( ( value ) => {
console . log ( 2 , value ) ;
} ) ;
// Invok
【文件预览】:
eventmit-master
----.mocharc.json(58B)
----example.ts(228B)
----.github()
--------workflows()
----yarn.lock(190KB)
----src()
--------eventmit.ts(870B)
----tsconfig.json(861B)
----LICENSE(1KB)
----test()
--------tsconfig.json(217B)
--------eventmit.test.ts(2KB)
----README.md(3KB)
----.gitignore(3KB)
----package.json(2KB)