2021-01-11 12:13:41 -05:00
|
|
|
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
2020-01-29 12:54:23 -05:00
|
|
|
|
|
|
|
/// <reference no-default-lib="true" />
|
2020-04-16 17:40:29 -04:00
|
|
|
/// <reference lib="deno.ns" />
|
2020-02-19 00:34:11 -05:00
|
|
|
/// <reference lib="deno.shared_globals" />
|
2021-03-01 05:31:13 -05:00
|
|
|
/// <reference lib="deno.webgpu" />
|
2020-01-29 12:54:23 -05:00
|
|
|
/// <reference lib="esnext" />
|
|
|
|
|
2020-10-11 18:04:43 -04:00
|
|
|
declare class WorkerGlobalScope {
|
|
|
|
new(): WorkerGlobalScope;
|
|
|
|
self: WorkerGlobalScope & typeof globalThis;
|
2020-10-08 05:43:26 -04:00
|
|
|
onmessage:
|
|
|
|
| ((
|
2020-10-11 18:04:43 -04:00
|
|
|
this: WorkerGlobalScope & typeof globalThis,
|
2020-10-08 05:43:26 -04:00
|
|
|
ev: MessageEvent,
|
|
|
|
) => any)
|
|
|
|
| null;
|
|
|
|
onmessageerror:
|
|
|
|
| ((
|
2020-10-11 18:04:43 -04:00
|
|
|
this: WorkerGlobalScope & typeof globalThis,
|
2020-10-08 05:43:26 -04:00
|
|
|
ev: MessageEvent,
|
|
|
|
) => any)
|
|
|
|
| null;
|
|
|
|
onerror:
|
|
|
|
| ((
|
2020-10-11 18:04:43 -04:00
|
|
|
this: WorkerGlobalScope & typeof globalThis,
|
2020-10-08 05:43:26 -04:00
|
|
|
ev: ErrorEvent,
|
|
|
|
) => any)
|
|
|
|
| null;
|
|
|
|
close: () => void;
|
|
|
|
postMessage: (message: any) => void;
|
2020-04-16 17:40:29 -04:00
|
|
|
Deno: typeof Deno;
|
2021-03-08 07:27:49 -05:00
|
|
|
WorkerNavigator: typeof WorkerNavigator;
|
2021-03-01 05:31:13 -05:00
|
|
|
navigator: WorkerNavigator;
|
2021-03-08 07:27:49 -05:00
|
|
|
WorkerLocation: typeof WorkerLocation;
|
|
|
|
location: WorkerLocation;
|
2021-03-01 05:31:13 -05:00
|
|
|
}
|
|
|
|
|
2021-03-08 07:27:49 -05:00
|
|
|
declare class WorkerNavigator {
|
|
|
|
constructor();
|
2021-03-01 05:31:13 -05:00
|
|
|
readonly gpu: GPU;
|
2020-01-29 12:54:23 -05:00
|
|
|
}
|
|
|
|
|
2021-03-08 07:27:49 -05:00
|
|
|
declare var navigator: WorkerNavigator;
|
|
|
|
|
2020-10-11 18:04:43 -04:00
|
|
|
declare class DedicatedWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
|
new(): DedicatedWorkerGlobalScope;
|
|
|
|
name: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
declare var self: WorkerGlobalScope & typeof globalThis;
|
2020-10-08 05:43:26 -04:00
|
|
|
declare var onmessage:
|
|
|
|
| ((
|
2020-10-11 18:04:43 -04:00
|
|
|
this: WorkerGlobalScope & typeof globalThis,
|
2020-10-08 05:43:26 -04:00
|
|
|
ev: MessageEvent,
|
|
|
|
) => any)
|
|
|
|
| null;
|
|
|
|
declare var onmessageerror:
|
|
|
|
| ((
|
2020-10-11 18:04:43 -04:00
|
|
|
this: WorkerGlobalScope & typeof globalThis,
|
2020-10-08 05:43:26 -04:00
|
|
|
ev: MessageEvent,
|
|
|
|
) => any)
|
|
|
|
| null;
|
2020-09-25 17:23:35 -04:00
|
|
|
declare var onerror:
|
2020-01-29 12:54:23 -05:00
|
|
|
| ((
|
2020-10-11 18:04:43 -04:00
|
|
|
this: WorkerGlobalScope & typeof globalThis,
|
2020-10-08 05:43:26 -04:00
|
|
|
ev: ErrorEvent,
|
|
|
|
) => any)
|
|
|
|
| null;
|
|
|
|
declare var close: () => void;
|
|
|
|
declare var name: string;
|
|
|
|
declare var postMessage: (message: any) => void;
|
2021-01-17 10:28:54 -05:00
|
|
|
|
|
|
|
// TODO(nayeemrmn): Move this to `op_crates/web` where its implementation is.
|
|
|
|
// The types there must first be split into window, worker and global types.
|
|
|
|
/** The absolute location of the script executed by the Worker. Such an object
|
|
|
|
* is initialized for each worker and is available via the
|
|
|
|
* WorkerGlobalScope.location property obtained by calling self.location. */
|
|
|
|
declare class WorkerLocation {
|
|
|
|
constructor();
|
|
|
|
readonly hash: string;
|
|
|
|
readonly host: string;
|
|
|
|
readonly hostname: string;
|
|
|
|
readonly href: string;
|
|
|
|
toString(): string;
|
|
|
|
readonly origin: string;
|
|
|
|
readonly pathname: string;
|
|
|
|
readonly port: string;
|
|
|
|
readonly protocol: string;
|
|
|
|
readonly search: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO(nayeemrmn): Move this to `op_crates/web` where its implementation is.
|
|
|
|
// The types there must first be split into window, worker and global types.
|
|
|
|
declare var location: WorkerLocation;
|