[JS] Expose global as `self` too
See original GitHub issueIn JavascriptCore self is not defined. Libraries like bluebird for example rely on self being the global object instead of window, as it works in web workers too.
This fails in react-native due to self not being defined. A simple global.self = global at the beginning of the script solves this issue. Could we get this into the default packaged code so that we don’t have to put the statement in there by ourselves?
Edit: As discussed in https://github.com/petkaantonov/bluebird/issues/630
Issue Analytics
- State:
- Created 8 years ago
- Comments:10 (8 by maintainers)
Top Results From Across the Web
How to avoid global variables in JavaScript? - Stack Overflow
The easiest way is to wrap your code in a closure and manually expose only those variables you need globally to the global...
Read more >JavaScript: Correct way to define global variables
Correct way to declare global variable in JavaScript ... The proper way is to use window object. And use the syntax like this:...
Read more >Avoiding mutable global state in browser JS | by Josh Wulf
Global scope is a feature of browser JavaScript that is a source of application-spanning bugs (it is global). Global state doesn't just ...
Read more >The JavaScript Global Object Variable — When Should We ...
The global object is always in the topmost scope. There's nothing else above it. Therefore, it can be accessed by anything. Consider the...
Read more >JavaScript Global Object | Contentful
Thinking of front-end code, it's clear that additional global variables do have a strong use case. Libraries like jQuery place themselves in the ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

yay https://github.com/johanneslumpe/react-native-browser-polyfill
Published as
react-native-browser-polyfill!