RealOrangeOne / react-native-mock

A fully mocked and test-friendly version of react native (maintainers wanted)
MIT License
571 stars 153 forks source link

Remove explicit use of `window` #79

Closed RealOrangeOne closed 8 years ago

RealOrangeOne commented 8 years ago

Window as a global doesnt exist when run under Node.JS. However, if run under something like jsdom, it does.

This PR allows window to be accessed if it exists, but stops anything breaking if it doesnt exist.

Should fix #69

lelandrichardson commented 8 years ago

@RealOrangeOne what about just using global, since any bundler that runs this code in the browser will use window for that.

if (global && global.cancelAnimationFrame) { ... }
lelandrichardson commented 8 years ago

LGTM