mirror of
https://github.com/denoland/deno.git
synced 2025-07-24 05:35:33 +00:00
workers: proper TS libs, more spec-compliant APIs (#3812)
* split lib.deno_main.d.ts into: - lib.deno.shared_globals.d.ts - lib.deno.window.d.ts - lib.deno.worker.d.ts * remove no longer used libs: - lib.deno_main.d.ts - lib.deno_worker.d.ts * change module loading to use proper TS library for compilation * align to Worker API spec: - Worker.terminate() - self.close() - self.name
This commit is contained in:
parent
d14864c57c
commit
161adfc51b
24 changed files with 449 additions and 287 deletions
|
@ -54,7 +54,7 @@ export async function getMessage(): Promise<any> {
|
|||
let isClosing = false;
|
||||
let hasBootstrapped = false;
|
||||
|
||||
export function workerClose(): void {
|
||||
export function close(): void {
|
||||
isClosing = true;
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ export const workerRuntimeGlobalProperties = {
|
|||
self: readOnly(globalThis),
|
||||
onmessage: writable(onmessage),
|
||||
onerror: writable(onerror),
|
||||
workerClose: nonEnumerable(workerClose),
|
||||
close: nonEnumerable(close),
|
||||
postMessage: writable(postMessage)
|
||||
};
|
||||
|
||||
|
@ -122,5 +122,6 @@ export function bootstrapWorkerRuntime(name: string): void {
|
|||
Object.defineProperties(globalThis, windowOrWorkerGlobalScopeProperties);
|
||||
Object.defineProperties(globalThis, workerRuntimeGlobalProperties);
|
||||
Object.defineProperties(globalThis, eventTargetProperties);
|
||||
Object.defineProperties(globalThis, { name: readOnly(name) });
|
||||
runtime.start(false, name);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue