diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2021-06-18 21:34:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-18 21:34:51 +0200 |
commit | a8e4fc15e516299e9bfc466ae3b2711b6ce2fcd3 (patch) | |
tree | 290da72c6e792bb0d2586c80ffa28db9baa78066 | |
parent | 0cbaeca026a7d79a57c859e5e395f0d998fab5d1 (diff) |
fix: Worker accepts specifier as URL (#11038)
This commit updates type declarations for Worker to accept specifiers
as either strings or URL, bringing it in line with TypeScript
declarations and browser behavior.
-rw-r--r-- | cli/dts/lib.deno.shared_globals.d.ts | 2 | ||||
-rw-r--r-- | cli/tests/workers/test.ts | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/cli/dts/lib.deno.shared_globals.d.ts b/cli/dts/lib.deno.shared_globals.d.ts index 9537f8cd8..d46a43e67 100644 --- a/cli/dts/lib.deno.shared_globals.d.ts +++ b/cli/dts/lib.deno.shared_globals.d.ts @@ -405,7 +405,7 @@ declare class Worker extends EventTarget { onmessage?: (e: MessageEvent) => void; onmessageerror?: (e: MessageEvent) => void; constructor( - specifier: string, + specifier: string | URL, options?: WorkerOptions, ); postMessage(message: any, transfer: ArrayBuffer[]): void; diff --git a/cli/tests/workers/test.ts b/cli/tests/workers/test.ts index bf1e46a34..6a572b92f 100644 --- a/cli/tests/workers/test.ts +++ b/cli/tests/workers/test.ts @@ -161,7 +161,7 @@ Deno.test({ const promise = deferred(); const busyWorker = new Worker( - new URL("busy_worker.js", import.meta.url).href, + new URL("busy_worker.js", import.meta.url), { type: "module" }, ); @@ -194,7 +194,7 @@ Deno.test({ const promise = deferred(); const racyWorker = new Worker( - new URL("racy_worker.js", import.meta.url).href, + new URL("racy_worker.js", import.meta.url), { type: "module" }, ); @@ -219,7 +219,7 @@ Deno.test({ const promise2 = deferred(); const worker = new Worker( - new URL("event_worker.js", import.meta.url).href, + new URL("event_worker.js", import.meta.url), { type: "module" }, ); @@ -263,7 +263,7 @@ Deno.test({ const promise1 = deferred(); const worker = new Worker( - new URL("event_worker_scope.js", import.meta.url).href, + new URL("event_worker_scope.js", import.meta.url), { type: "module" }, ); @@ -292,11 +292,11 @@ Deno.test({ const promise2 = deferred(); const regularWorker = new Worker( - new URL("non_deno_worker.js", import.meta.url).href, + new URL("non_deno_worker.js", import.meta.url), { type: "module" }, ); const denoWorker = new Worker( - new URL("deno_worker.ts", import.meta.url).href, + new URL("deno_worker.ts", import.meta.url), { type: "module", deno: { |