This commit is contained in:
2017-04-29 21:23:26 +02:00
commit 5b02d2321e
13 changed files with 444 additions and 0 deletions

12
ts/index.ts Normal file
View File

@ -0,0 +1,12 @@
import * as plugins from './smartevent.plugins'
import { EventEmitter } from 'events'
export {
EventEmitter
}
export let once = async <T>(eventEmitter: EventEmitter, eventName: string): Promise<T> => {
let done = plugins.smartq.defer<T>()
eventEmitter.once(eventName,done.resolve)
return await done.promise
}

8
ts/smartevent.plugins.ts Normal file
View File

@ -0,0 +1,8 @@
import 'typings-global'
import * as smartq from 'smartq'
import events = require('events')
export {
events,
smartq
}