暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. export = EventEmitter;
  2. /**
  3. * Constructs a new event emitter instance.
  4. * @classdesc A minimal event emitter.
  5. * @memberof util
  6. * @constructor
  7. */
  8. declare class EventEmitter {
  9. /**
  10. * Constructs a new event emitter instance.
  11. * @classdesc A minimal event emitter.
  12. * @memberof util
  13. * @constructor
  14. */
  15. constructor();
  16. /**
  17. * Registers an event listener.
  18. * @param {string} evt Event name
  19. * @param {function} fn Listener
  20. * @param {*} [ctx] Listener context
  21. * @returns {util.EventEmitter} `this`
  22. */
  23. on(evt: string, fn: () => any, ctx?: any): EventEmitter;
  24. /**
  25. * Removes an event listener or any matching listeners if arguments are omitted.
  26. * @param {string} [evt] Event name. Removes all listeners if omitted.
  27. * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted.
  28. * @returns {util.EventEmitter} `this`
  29. */
  30. off(evt?: string, fn?: () => any): EventEmitter;
  31. /**
  32. * Emits an event by calling its listeners with the specified arguments.
  33. * @param {string} evt Event name
  34. * @param {...*} args Arguments
  35. * @returns {util.EventEmitter} `this`
  36. */
  37. emit(evt: string, ...args: any[]): EventEmitter;
  38. }