Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

window. child objects return undefined when using NW.js #2297

Closed
nicklaw5 opened this issue Feb 4, 2016 · 1 comment
Closed

window. child objects return undefined when using NW.js #2297

nicklaw5 opened this issue Feb 4, 2016 · 1 comment

Comments

@nicklaw5
Copy link

nicklaw5 commented Feb 4, 2016

I've just begun using NW.js alongside vue.js for a project. When attempting to declare vue via the node require method, I found three issues relating to the navigator, document and DocumentFragment objects, which I'm guessing relates specifically to NW.js but perhaps also other projects as well.

Each of the above object references in the vue.common.js file need to be prefixed with window.. For example:

  • window.navigator
  • window.document
  • window.DocumentFragment

Failure to do so will result in an undefined error, like this:
Uncaught ReferenceError: navigator is not defined

As @Teevio mentioned in my forum post, it would seem that NW.js only makes these variables available explicitly via the window object. This could be because NW.js provides it's own Window object, which is a wrapper of the DOM’s window object (see here).

@yyx990803
Copy link
Member

I don't think you need to use window.document in nw.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants