diff --git a/.gitignore b/.gitignore index c964f38..846875a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ lib es yarn-error.log .idea +.direnv +.envrc \ No newline at end of file diff --git a/src/waitForEvent.ts b/src/waitForEvent.ts index 9fba66b..d07d3b8 100644 --- a/src/waitForEvent.ts +++ b/src/waitForEvent.ts @@ -1,4 +1,4 @@ -import {execute} from './execute'; +import { execute } from './execute'; export type EventTargetLike = | EventTargetLike.HasEventTargetAddRemove @@ -28,7 +28,7 @@ export type EventTargetLike = export function waitForEvent( signal: AbortSignal, target: EventTargetLike, - eventName: string, + eventName: string | symbol, options?: EventTargetLike.EventListenerOptions, ): Promise { return execute(signal, resolve => { @@ -87,23 +87,23 @@ export namespace EventTargetLike { // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/847731ba1d7fa6db6b911c0e43aa0afe596e7723/types/jquery/misc.d.ts#L6395 export interface JQueryStyleEventEmitter { on: ( - eventName: string, + eventName: string | symbol, handler: (this: TContext, t: T, ...args: any[]) => any, ) => void; off: ( - eventName: string, + eventName: string | symbol, handler: (this: TContext, t: T, ...args: any[]) => any, ) => void; } export interface HasEventTargetAddRemove { addEventListener( - type: string, + type: string | symbol, listener: ((evt: E) => void) | null, options?: boolean | AddEventListenerOptions, ): void; removeEventListener( - type: string, + type: string | symbol, listener: ((evt: E) => void) | null, options?: EventListenerOptions | boolean, ): void; @@ -123,7 +123,7 @@ export namespace EventTargetLike { function listen( target: EventTargetLike, - eventName: string, + eventName: string | symbol, handler: (...args: any[]) => void, options?: EventTargetLike.EventListenerOptions, ) {