index.d.ts 508 B

1234567891011121314
  1. /// <reference types="node" />
  2. import { EventEmitter } from 'events';
  3. declare function once<T>(emitter: EventEmitter, name: string): once.CancelablePromise<T>;
  4. declare namespace once {
  5. interface CancelFunction {
  6. (): void;
  7. }
  8. interface CancelablePromise<T> extends Promise<T> {
  9. cancel: CancelFunction;
  10. }
  11. type CancellablePromise<T> = CancelablePromise<T>;
  12. function spread<T extends any[]>(emitter: EventEmitter, name: string): once.CancelablePromise<T>;
  13. }
  14. export = once;