UNPKG

@ayonli/jsext

Version:

A JavaScript extension package for building strong and modern applications.

37 lines (36 loc) 1.81 kB
/** * Functions for working with events. * @module */ import "./external/event-target-polyfill/index.ts"; /** * Creates an `ErrorEvent` instance based on the given options. If the * `ErrorEvent` constructor is not available, the generic `Event` constructor * will be used instead, and the options will be attached to the event as its * properties. */ export declare function createErrorEvent(type: "error", options?: ErrorEventInit): ErrorEvent; export declare function createErrorEvent(type: string, options?: ErrorEventInit): ErrorEvent; /** * Creates a `CloseEvent` instance based on the given options. If the * `CloseEvent` constructor is not available, the generic `Event` constructor * will be used instead, and the options will be attached to the event as its * properties. */ export declare function createCloseEvent(type: "close", options?: CloseEventInit): CloseEvent; export declare function createCloseEvent(type: string, options?: CloseEventInit): CloseEvent; /** * Creates a `ProgressEvent` instance based on the given options. If the * `ProgressEvent` constructor is not available, the generic `Event` constructor * will be used instead, and the options will be attached to the event as its * properties. */ export declare function createProgressEvent(type: "progress", options?: ProgressEventInit): ProgressEvent; export declare function createProgressEvent(type: string, options?: ProgressEventInit): ProgressEvent; /** * Creates a `CustomEvent` instance based on the given options. If the * `CustomEvent` constructor is not available, the generic `Event` constructor * will be used instead, and the options will be attached to the event as its * properties. */ export declare function createCustomEvent<T = any>(type: string, options?: CustomEventInit<T>): CustomEvent<T>;