GithubHelp home page GithubHelp logo

Comments (9)

richardanaya avatar richardanaya commented on July 18, 2024

Verified, I was able to fix this just by doing a search replace on "global" to something else

from observe-js.

rafaelw avatar rafaelw commented on July 18, 2024

I don't know anything about node-webkit. I'm going to close this issue, but ask anyone who this is hurting to submit a PR to fix it.

from observe-js.

wilkerlucio avatar wilkerlucio commented on July 18, 2024

I'm having this issue here, it actually starts with not finding ArraySplice... any hint on how to fix that? I really wanna use polymer with node-webkit...

from observe-js.

rafaelw avatar rafaelw commented on July 18, 2024

The issue here isn't really observe-js, it's all of Polymer. Node's top-level scope isn't the global scope, so the only way to fix this would be to have polymer change to use a node-friendly package system, or to have all uses of symbols check for the symbol in the top-level scope and also on 'global.'

from observe-js.

rafaelw avatar rafaelw commented on July 18, 2024

@mattsmcnulty

from observe-js.

cadorn avatar cadorn commented on July 18, 2024

change to use a node-friendly package system, or to have all uses of symbols check for the symbol in the top-level scope and also on 'global.'

I would not single out NodeJS here. NodeJS is not the only server environment and I can see polymer being used on others.

Check for exports global to detect CommonJS environment as a start.

from observe-js.

wilkerlucio avatar wilkerlucio commented on July 18, 2024

agreed with @cadorn

from observe-js.

wilkerlucio avatar wilkerlucio commented on July 18, 2024

actually I found a fix here, I got the compiled polymer file, search and replace "global" with something else (I used fakeGlobal, but almost any name will do the same). but it's hacky and ugly...

from observe-js.

FunkMonkey avatar FunkMonkey commented on July 18, 2024

The problem is the last line of observe.js, which tries to differentiate between node.js and the browser:

})(typeof global !== 'undefined' && global ? global : this || window);

In a node-webkit html page, both global and window exist. Unfortunately observe is polyfilled on global though it is needed on window. But as @cadorn pointed out, exports does not exist in a node-webkit html page, neither does module. And this points to window and not to exports as in a node.js module.

There are various ways to check for node-webkit now, one of them could simply be:

})(typeof global !== 'undefined' && global && typeof module !== 'undefined' && module ? global : this || window);

@rafaelw: As I see it, this issue is not effecting all of polymer, but only the javascript-specific polyfills like Object.observe which are designed to work in node.js too. All browser polyfills don't work in node anyway... Thus WeakMap should be the only other that might need such a fix, but looking at the source, it is currently browser-only anyway (relying on window)

from observe-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.