mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 20:29:11 +00:00
feat(worker): add MessageEvent, ErrorEvent and handling to Worker API (#4391)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
This commit is contained in:
parent
0ea6eb83a9
commit
25bd6868e5
5 changed files with 208 additions and 36 deletions
38
cli/js/lib.deno.shared_globals.d.ts
vendored
38
cli/js/lib.deno.shared_globals.d.ts
vendored
|
@ -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?: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue