summaryrefslogtreecommitdiff
path: root/cli/js/lib.deno.shared_globals.d.ts
diff options
context:
space:
mode:
authorcrowlKats <13135287+crowlKats@users.noreply.github.com>2020-04-13 18:34:32 +0200
committerGitHub <noreply@github.com>2020-04-13 18:34:32 +0200
commit25bd6868e5af9f30656dabeff9683b256e0a9370 (patch)
tree60925e31d536467e96a90dbf4bb10bf91fbe37f5 /cli/js/lib.deno.shared_globals.d.ts
parent0ea6eb83a906bff543be4c3301f23444986b022b (diff)
feat(worker): add MessageEvent, ErrorEvent and handling to Worker API (#4391)
Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Diffstat (limited to 'cli/js/lib.deno.shared_globals.d.ts')
-rw-r--r--cli/js/lib.deno.shared_globals.d.ts38
1 files changed, 34 insertions, 4 deletions
diff --git a/cli/js/lib.deno.shared_globals.d.ts b/cli/js/lib.deno.shared_globals.d.ts
index f7f9b346b..f84a056db 100644
--- a/cli/js/lib.deno.shared_globals.d.ts
+++ b/cli/js/lib.deno.shared_globals.d.ts
@@ -1037,14 +1037,44 @@ declare const URL: {
revokeObjectURL(url: string): void;
};
+interface MessageEventInit extends EventInit {
+ data?: any;
+ origin?: string;
+ lastEventId?: string;
+}
+
+declare class MessageEvent extends Event {
+ readonly data: any;
+ readonly origin: string;
+ readonly lastEventId: string;
+ constructor(type: string, eventInitDict?: MessageEventInit);
+}
+
+interface ErrorEventInit extends EventInit {
+ message?: string;
+ filename?: string;
+ lineno?: number;
+ colno?: number;
+ error?: any;
+}
+
+declare class ErrorEvent extends Event {
+ readonly message: string;
+ readonly filename: string;
+ readonly lineno: number;
+ readonly colno: number;
+ readonly error: any;
+ constructor(type: string, eventInitDict?: ErrorEventInit);
+}
+
interface PostMessageOptions {
transfer?: any[];
}
-declare class Worker {
- onerror?: (e: Event) => void;
- onmessage?: (data: any) => void;
- onmessageerror?: () => void;
+declare class Worker extends EventTarget {
+ onerror?: (e: ErrorEvent) => void;
+ onmessage?: (e: MessageEvent) => void;
+ onmessageerror?: (e: MessageEvent) => void;
constructor(
specifier: string,
options?: {