initial
This commit is contained in:
12
ts/index.ts
Normal file
12
ts/index.ts
Normal 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
8
ts/smartevent.plugins.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import 'typings-global'
|
||||
import * as smartq from 'smartq'
|
||||
import events = require('events')
|
||||
|
||||
export {
|
||||
events,
|
||||
smartq
|
||||
}
|
Reference in New Issue
Block a user