Use this rather than global in prelude

Summary: in new-style builds, the prelude is not wrapped into an IIFE, so `global` is not available. Since the bundle as a whole is not running in strict mode, we can access the global object with `this`.

Reviewed By: jeanlauliac

Differential Revision: D5051731

fbshipit-source-id: 4003b5e57ba8626e38e68e92d5778c2c59ca69a5
This commit is contained in:
David Aurelio
2017-05-12 09:46:04 -07:00
committed by Facebook Github Bot
parent 0a4ce80868
commit e1306565db
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -97,6 +97,6 @@ function* concat<T>(...iterables: Array<Iterable<T>>): Iterable<T> {
function prelude(optimize) {
return virtualModule(
`var __DEV__=${String(!optimize)},` +
'__BUNDLE_START_TIME__=global.nativePerformanceNow?global.nativePerformanceNow():Date.now();'
'__BUNDLE_START_TIME__=this.nativePerformanceNow?nativePerformanceNow():Date.now();'
);
}