diff options
Diffstat (limited to 'cli')
-rw-r--r-- | cli/dts/lib.deno.window.d.ts | 9 | ||||
-rw-r--r-- | cli/dts/lib.deno.worker.d.ts | 10 | ||||
-rw-r--r-- | cli/tests/unit/globals_test.ts | 6 | ||||
-rw-r--r-- | cli/tests/workers/test.ts | 2 | ||||
-rw-r--r-- | cli/tests/workers/worker_globals.ts | 3 |
5 files changed, 24 insertions, 6 deletions
diff --git a/cli/dts/lib.deno.window.d.ts b/cli/dts/lib.deno.window.d.ts index 2d46e5fe0..3eebab677 100644 --- a/cli/dts/lib.deno.window.d.ts +++ b/cli/dts/lib.deno.window.d.ts @@ -18,19 +18,24 @@ declare class Window extends EventTarget { confirm: (message?: string) => boolean; prompt: (message?: string, defaultValue?: string) => string | null; Deno: typeof Deno; + Navigator: typeof Navigator; navigator: Navigator; + Location: typeof Location; + location: Location; } declare var window: Window & typeof globalThis; declare var self: Window & typeof globalThis; declare var onload: ((this: Window, ev: Event) => any) | null; declare var onunload: ((this: Window, ev: Event) => any) | null; -declare var navigator: Navigator; -declare interface Navigator { +declare class Navigator { + constructor(); readonly gpu: GPU; } +declare var navigator: Navigator; + /** * Shows the given message and waits for the enter key pressed. * If the stdin is not interactive, it does nothing. diff --git a/cli/dts/lib.deno.worker.d.ts b/cli/dts/lib.deno.worker.d.ts index 93549ecd5..653a8931b 100644 --- a/cli/dts/lib.deno.worker.d.ts +++ b/cli/dts/lib.deno.worker.d.ts @@ -30,15 +30,19 @@ declare class WorkerGlobalScope { close: () => void; postMessage: (message: any) => void; Deno: typeof Deno; + WorkerNavigator: typeof WorkerNavigator; navigator: WorkerNavigator; + WorkerLocation: typeof WorkerLocation; + location: WorkerLocation; } -declare var navigator: WorkerNavigator; - -declare interface WorkerNavigator { +declare class WorkerNavigator { + constructor(); readonly gpu: GPU; } +declare var navigator: WorkerNavigator; + declare class DedicatedWorkerGlobalScope extends WorkerGlobalScope { new(): DedicatedWorkerGlobalScope; name: string; diff --git a/cli/tests/unit/globals_test.ts b/cli/tests/unit/globals_test.ts index dbb9bd90a..ce43fddf1 100644 --- a/cli/tests/unit/globals_test.ts +++ b/cli/tests/unit/globals_test.ts @@ -48,6 +48,12 @@ unitTest(function globalThisInstanceofEventTarget(): void { assert(globalThis instanceof EventTarget); }); +unitTest(function navigatorInstanceofNavigator(): void { + // TODO(nayeemrmn): Add `Navigator` to deno_lint globals. + // deno-lint-ignore no-undef + assert(navigator instanceof Navigator); +}); + unitTest(function DenoNamespaceExists(): void { assert(Deno != null); }); diff --git a/cli/tests/workers/test.ts b/cli/tests/workers/test.ts index c2dd41aee..e5e9e44f7 100644 --- a/cli/tests/workers/test.ts +++ b/cli/tests/workers/test.ts @@ -118,7 +118,7 @@ Deno.test({ workerOptions, ); w.onmessage = (e): void => { - assertEquals(e.data, "true, true, true"); + assertEquals(e.data, "true, true, true, true"); promise.resolve(); }; w.postMessage("Hello, world!"); diff --git a/cli/tests/workers/worker_globals.ts b/cli/tests/workers/worker_globals.ts index a9e7efd85..f26242306 100644 --- a/cli/tests/workers/worker_globals.ts +++ b/cli/tests/workers/worker_globals.ts @@ -4,6 +4,9 @@ onmessage = function (): void { self instanceof DedicatedWorkerGlobalScope, self instanceof WorkerGlobalScope, self instanceof EventTarget, + // TODO(nayeemrmn): Add `WorkerNavigator` to deno_lint globals. + // deno-lint-ignore no-undef + navigator instanceof WorkerNavigator, ].join(", "), ); close(); |