Comments (9)
Verified, I was able to fix this just by doing a search replace on "global" to something else
from observe-js.
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.
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.
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.
from observe-js.
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.
agreed with @cadorn
from observe-js.
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.
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)
- .set doesnt work with computed bindings, computed properties, or observers
- FTLOG HOT 3
- TypeError: Object.observe is not a function HOT 2
- Build system seems to be broken
- Ability to have performMicrotaskCheckpoint not attached to global
- Use regular expressions instead of state machine HOT 3
- Even faster compiledGetValueFromFn HOT 1
- Is this supposed to work? HOT 3
- Support AMD loading with "define"
- version on npm is 0.4.2 while releases here on github show latest as 0.5.6 HOT 5
- utlise proxy on systems where Proxy is supported HOT 1
- 7 tests broken on latest FF and 6 on Chrome
- Pathobserver on document.title - works in ff, not in chrome
- Supress Object.observe deprecation warning
- IGNORE
- ObjectObserver does not report observed object onChange event
- Chrome 50 breaks this lib HOT 11
- About delivery of changes
- ObjectObserver doesn't seem to work in Safari iOS HOT 3
- Tag with ^1.0.0
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from observe-js.