10

Deno claims to be browser-compatible. Does that mean it has a window / navigator object and what would that mean in terms of things like setting window.location?

pguardiario
  • 53,827
  • 19
  • 119
  • 159

1 Answers1

12

The global object in Deno is currently just called window (and globalThis due to upcoming ES standards, sadly). There is currently no navigator/window.location implemented.

The browser-compatible aspects of Deno are aiming to parts that are reasonable to exist even without under the browser environment, e.g. Event, TextEncoder, fetch, etc. It would be an unnecessary burden to implement things like the complete DOM in the Deno core, and such tasks should be delegated to third-party modules (like JSDOM if ported to Deno)

Update: window.location is added in Deno v0.3.0, pointing to the entry file's path (remote or local) (see usage in https://github.com/denoland/deno/issues/1750 , could be useful to implement something similar to Python's if __name__ == "__main__"

Kevin Qian
  • 2,532
  • 1
  • 16
  • 26