Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

fromEvent.d.ts 2.1KB

1234567891011121314151617181920212223242526272829303132333435
  1. import { Observable } from '../Observable';
  2. export interface NodeStyleEventEmitter {
  3. addListener: (eventName: string | symbol, handler: NodeEventHandler) => this;
  4. removeListener: (eventName: string | symbol, handler: NodeEventHandler) => this;
  5. }
  6. export declare type NodeEventHandler = (...args: any[]) => void;
  7. export interface NodeCompatibleEventEmitter {
  8. addListener: (eventName: string, handler: NodeEventHandler) => void | {};
  9. removeListener: (eventName: string, handler: NodeEventHandler) => void | {};
  10. }
  11. export interface JQueryStyleEventEmitter {
  12. on: (eventName: string, handler: Function) => void;
  13. off: (eventName: string, handler: Function) => void;
  14. }
  15. export interface HasEventTargetAddRemove<E> {
  16. addEventListener(type: string, listener: ((evt: E) => void) | null, options?: boolean | AddEventListenerOptions): void;
  17. removeEventListener(type: string, listener?: ((evt: E) => void) | null, options?: EventListenerOptions | boolean): void;
  18. }
  19. export declare type EventTargetLike<T> = HasEventTargetAddRemove<T> | NodeStyleEventEmitter | NodeCompatibleEventEmitter | JQueryStyleEventEmitter;
  20. export declare type FromEventTarget<T> = EventTargetLike<T> | ArrayLike<EventTargetLike<T>>;
  21. export interface EventListenerOptions {
  22. capture?: boolean;
  23. passive?: boolean;
  24. once?: boolean;
  25. }
  26. export interface AddEventListenerOptions extends EventListenerOptions {
  27. once?: boolean;
  28. passive?: boolean;
  29. }
  30. export declare function fromEvent<T>(target: FromEventTarget<T>, eventName: string): Observable<T>;
  31. /** @deprecated resultSelector no longer supported, pipe to map instead */
  32. export declare function fromEvent<T>(target: FromEventTarget<T>, eventName: string, resultSelector: (...args: any[]) => T): Observable<T>;
  33. export declare function fromEvent<T>(target: FromEventTarget<T>, eventName: string, options: EventListenerOptions): Observable<T>;
  34. /** @deprecated resultSelector no longer supported, pipe to map instead */
  35. export declare function fromEvent<T>(target: FromEventTarget<T>, eventName: string, options: EventListenerOptions, resultSelector: (...args: any[]) => T): Observable<T>;