【文件属性】:
文件名称:raptor-pubsub:支持浏览器中的 PubSub 通信
文件大小:3KB
文件格式:ZIP
更新时间:2021-07-05 01:13:24
JavaScript
猛禽发布订阅
超轻量级模块,支持浏览器和服务器端基于的 Pub/Sub 通信。
安装
npm install raptor-pubsub --save
用法
在全球发布/订阅频道上进行交流
var raptorPubsub = require ( 'raptor-pubsub' ) ;
// Subscribe to an event
raptorPubsub . on ( 'someEvent' , function ( arg ) {
// Do something...
} ) ;
// Publish an event
raptorPubsub . emit ( 'someEvent' , 'Hello World' ) ;
在指定的发布/订阅频道上进行通信
// Get a reference to named pub/sub channel
var channel =
【文件预览】:
raptor-pubsub-master
----package.json(790B)
----.gitignore(97B)
----lib()
--------index.js(181B)
--------raptor-pubsub.js(453B)
----README.md(1KB)
----.jshintrc(689B)