Repository navigation
Handle cases where self isn't defined - #253
Conversation
|
Looks good! @dgraham Any objections? |
|
Invoking the wrapper function with |
|
Wouldn't this still throw a |
|
Good point @chrisirhc. Someone should test this out in an isomorphic environment and report back. I have no idea how it would handle the |
|
Hmm, yes that is true. Another option could be: this.self || thisWhich works exactly the same way but should not throw. |
9045eec to
504e4a4
Compare
|
I have updated the code as per the above comment. |
|
Can someone test this out in an isomorphic environment, as per people's complaints on aforementioned threads? |
|
Node - master branch: Node - this PR: React Native - master I can't speak for other environments though |
There was a problem hiding this comment.
I feel like I would like to revert to @chrisirhc's idea by doing
typeof self !== 'undefined' ? self : thissimply because that approach has been better battle-tested by compilers such as Browserify.
504e4a4 to
ad009dc
Compare
|
@mislav updated as-per your comment |
Handle cases where `self` isn't defined
|
Thank you! |
|
@yorkie Something's wrong with our build system and auto-publish on npm. Stay tuned. |
|
I just did a manual `npm publish` for now.
|
As per: #125 (comment)
Resolves #252, #238, #165, #125, #124, and probably a few others.
There are a lot of different ways this code could be written. If you have style preferences contrary to the way I've done this, I'd be very happy to change it.