nodejs-promised-events:约定的事件

时间:2021-06-06 08:10:56
【文件属性】:
文件名称:nodejs-promised-events:约定的事件
文件大小:9KB
文件格式:ZIP
更新时间:2021-06-06 08:10:56
JavaScript 约定的事件 包具有与 Node.js 事件相同的功能,但是, emit函数将始终对为特定事件调用的所有函数进行 pomisify。 示例 1(承诺回调) em = new require ( 'promised-events' ) . PromisedEventEmitter em . on ( 'f' , function ( ) { return 10 ; } ) em . emit ( 'f' ) . then ( function ( result ) { console . log ( result ) } , function ( err ) { throw err ; } ) 将打印10 。 示例 2(承诺回调) fs = require ( 'fs' ) em . on ( 'readFileSync' , function
【文件预览】:
nodejs-promised-events-master
----.gitignore(526B)
----package.json(799B)
----src()
--------promised-events.coffee(5KB)
----promised-events.js(5KB)
----Gruntfile.js(963B)
----LICENSE(1KB)
----README.md(2KB)
----test()
--------SelfAdressedEventEmitter.js(4KB)
--------tests.js(5KB)

网友评论