switch to new org scheme
This commit is contained in:
23
ts/index.ts
23
ts/index.ts
@@ -1,9 +1,28 @@
|
||||
import * as plugins from './smartevent.plugins';
|
||||
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
export { EventEmitter };
|
||||
export {
|
||||
|
||||
};
|
||||
|
||||
export const once = async <T>(eventEmitter: EventEmitter, eventName: string): Promise<T> => {
|
||||
export class SmartEventEmitter {
|
||||
public eventSubject = new plugins.
|
||||
|
||||
public once () {
|
||||
|
||||
};
|
||||
|
||||
public emit () {
|
||||
|
||||
}
|
||||
|
||||
public on () {}
|
||||
}
|
||||
|
||||
// instrument globalThis
|
||||
|
||||
export const once = async <T>(eventEmitter: SmartEventEmitter, eventName: string): Promise<T> => {
|
||||
const done = plugins.smartpromise.defer<T>();
|
||||
eventEmitter.once(eventName, eventPayload => {
|
||||
done.resolve(eventPayload);
|
||||
|
@@ -1,4 +1,5 @@
|
||||
// pushrocks scope
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
import events = require('events');
|
||||
import * as events from 'events';
|
||||
|
||||
export { events, smartpromise };
|
||||
|
Reference in New Issue
Block a user