diff options
Diffstat (limited to 'runtime/js/98_global_scope_window.js')
-rw-r--r-- | runtime/js/98_global_scope_window.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/runtime/js/98_global_scope_window.js b/runtime/js/98_global_scope_window.js index 63b346dd5..3188c4b4c 100644 --- a/runtime/js/98_global_scope_window.js +++ b/runtime/js/98_global_scope_window.js @@ -1,6 +1,6 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -import { core, primordials } from "ext:core/mod.js"; +import { core, internals, primordials } from "ext:core/mod.js"; const { op_bootstrap_language, op_bootstrap_numcpus, @@ -108,7 +108,15 @@ const mainRuntimeGlobalProperties = { Location: location.locationConstructorDescriptor, location: location.locationDescriptor, Window: globalInterfaces.windowConstructorDescriptor, - window: util.getterOnly(() => globalThis), + window: util.getterOnly(() => { + internals.warnOnDeprecatedApi( + "window", + new Error().stack, + "Use `globalThis` or `self` instead.", + "You can provide `window` in the current scope with: `const window = globalThis`.", + ); + return globalThis; + }), self: util.getterOnly(() => globalThis), Navigator: util.nonEnumerable(Navigator), navigator: util.getterOnly(() => navigator), |