-
Notifications
You must be signed in to change notification settings - Fork 0
/
shared-worker.d.ts
46 lines (40 loc) · 2.74 KB
/
shared-worker.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
interface SharedWorkerGlobalScopeEventMap extends WorkerGlobalScopeEventMap {
"connect": MessageEvent;
}
interface WindowEventMap extends SharedWorkerGlobalScopeEventMap { }
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SharedWorkerGlobalScope) */
interface SharedWorkerGlobalScope extends WorkerGlobalScope {
/**
* Returns sharedWorkerGlobal's name, i.e. the value given to the SharedWorker constructor. Multiple SharedWorker objects can correspond to the same shared worker (and SharedWorkerGlobalScope), by reusing the same name.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SharedWorkerGlobalScope/name)
*/
readonly name: string;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SharedWorkerGlobalScope/connect_event) */
onconnect: ((this: SharedWorkerGlobalScope, ev: MessageEvent) => any) | null;
/**
* Aborts sharedWorkerGlobal.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SharedWorkerGlobalScope/close)
*/
close(): void;
addEventListener<K extends keyof SharedWorkerGlobalScopeEventMap>(type: K, listener: (this: SharedWorkerGlobalScope, ev: SharedWorkerGlobalScopeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof SharedWorkerGlobalScopeEventMap>(type: K, listener: (this: SharedWorkerGlobalScope, ev: SharedWorkerGlobalScopeEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
}
declare var SharedWorkerGlobalScope: {
prototype: SharedWorkerGlobalScope;
new(): SharedWorkerGlobalScope;
};
declare var onconnect: ((this: SharedWorkerGlobalScope, ev: MessageEvent) => any) | null;
declare function close(): void;
interface WorkerGlobalScope {
readonly name: string;
onconnect: ((this: SharedWorkerGlobalScope, ev: MessageEvent) => any) | null;
close(): void;
addEventListener<K extends keyof SharedWorkerGlobalScopeEventMap>(type: K, listener: (this: SharedWorkerGlobalScope, ev: SharedWorkerGlobalScopeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof SharedWorkerGlobalScopeEventMap>(type: K, listener: (this: SharedWorkerGlobalScope, ev: SharedWorkerGlobalScopeEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
}