diff --git a/index.d.ts b/index.d.ts index 947523c..17f26e0 100644 --- a/index.d.ts +++ b/index.d.ts @@ -4,3 +4,25 @@ /// declare var self: ServiceWorkerGlobalScope; +declare var clients: Clients; +declare var registration: ServiceWorkerRegistration; + +declare var onactivate: ((this: ServiceWorkerGlobalScope, ev: ExtendableEvent) => any) | null; +declare var onerror: ((this: ServiceWorkerGlobalScope, ev: ErrorEvent) => any) | null; +declare var onfetch: ((this: ServiceWorkerGlobalScope, ev: FetchEvent) => any) | null; +declare var oninstall: ((this: ServiceWorkerGlobalScope, ev: ExtendableEvent) => any) | null; +declare var onmessageerror: ((this: ServiceWorkerGlobalScope, ev: MessageEvent) => any) | null; +declare var onmessage: ((this: ServiceWorkerGlobalScope, ev: MessageEvent) => any) | null; +declare var onnotificationclick: ((this: ServiceWorkerGlobalScope, ev: NotificationEvent) => any) | null; +declare var onnotificationclose: ((this: ServiceWorkerGlobalScope, ev: NotificationEvent) => any) | null; +declare var onpush: ((this: ServiceWorkerGlobalScope, ev: PushEvent) => any) | null; +declare var onpushsubscriptionchange: ((this: ServiceWorkerGlobalScope, ev: PushSubscriptionChangeEvent) => any) | null; +declare var onsync: ((this: ServiceWorkerGlobalScope, ev: SyncEvent) => any) | null; + +declare function addEventListener(type: K, listener: (this: ServiceWorkerGlobalScope, ev: ServiceWorkerEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; +declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; +declare function removeEventListener(type: K, listener: (this: ServiceWorkerGlobalScope, ev: ServiceWorkerEventMap[K]) => any, options?: boolean | EventListenerOptions): void; +declare function removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +declare function skipWaiting(): Promise; +declare function addEventListener(type: K, listener: (this: ServiceWorkerGlobalScope, ev: ServiceWorkerGlobalScopeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; +declare function removeEventListener(type: K, listener: (this: ServiceWorkerGlobalScope, ev: ServiceWorkerGlobalScopeEventMap[K]) => any, options?: boolean | EventListenerOptions): void; diff --git a/src/webworker.d.ts b/src/webworker.d.ts index 88f1eae..bf71f59 100644 --- a/src/webworker.d.ts +++ b/src/webworker.d.ts @@ -4183,7 +4183,6 @@ interface WritableStreamErrorCallback { (reason: any): void | PromiseLike; } -declare var onmessage: ((this: DedicatedWorkerGlobalScope, ev: MessageEvent) => any) | null; declare function close(): void; declare function postMessage(message: any, transfer?: Transferable[]): void; /** @@ -4194,7 +4193,6 @@ declare function dispatchEvent(event: Event): boolean; declare var caches: CacheStorage; declare var isSecureContext: boolean; declare var location: WorkerLocation; -declare var onerror: ((this: DedicatedWorkerGlobalScope, ev: ErrorEvent) => any) | null; declare var performance: Performance; declare function msWriteProfilerMark(profilerMarkName: string): void; /** @@ -4225,9 +4223,7 @@ declare function fetch(input: RequestInfo, init?: RequestInit): Promise(type: K, listener: (this: DedicatedWorkerGlobalScope, ev: DedicatedWorkerGlobalScopeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; -declare function removeEventListener(type: K, listener: (this: DedicatedWorkerGlobalScope, ev: DedicatedWorkerGlobalScopeEventMap[K]) => any, options?: boolean | EventListenerOptions): void; declare function removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; type BlobPart = BufferSource | Blob | string; type HeadersInit = Headers | string[][] | Record;