Made Map & Set polyfills available globally
Summary: public Map and Set are a standard JavaScript features, but are only supported in a subset of JSC versions that we target (e.g. iOS 7's JSC doesn't support Set). The consequence of this is that failing to require('Set') before using it won't error during testing on a modern OS, but will fail on older OS versions. This diff makes the Map and Set polyfills available globally to all RN apps to avoid that problem. Reviewed By: davidaurelio Differential Revision: D2833997 fb-gh-sync-id: 713d8b69f6a1bce2472a1b2e6b84f69d75f30289
This commit is contained in:
parent
4afeb4310b
commit
cb45eaa0e8
|
@ -11,7 +11,6 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
var Map = require('Map');
|
||||
var NativeModules = require('NativeModules');
|
||||
var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
|
||||
var RCTAppState = NativeModules.AppState;
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
var AnimationsDebugModule = require('NativeModules').AnimationsDebugModule;
|
||||
var Dimensions = require('Dimensions');
|
||||
var InteractionMixin = require('InteractionMixin');
|
||||
var Map = require('Map');
|
||||
var NavigationContext = require('NavigationContext');
|
||||
var NavigatorBreadcrumbNavigationBar = require('NavigatorBreadcrumbNavigationBar');
|
||||
var NavigatorNavigationBar = require('NavigatorNavigationBar');
|
||||
|
|
|
@ -150,11 +150,15 @@ function setUpGeolocation() {
|
|||
polyfillGlobal('geolocation', require('Geolocation'), GLOBAL.navigator);
|
||||
}
|
||||
|
||||
function setUpMapAndSet() {
|
||||
polyfillGlobal('Map', require('Map'));
|
||||
polyfillGlobal('Set', require('Set'));
|
||||
}
|
||||
|
||||
function setUpProduct() {
|
||||
Object.defineProperty(GLOBAL.navigator, 'product', {value: 'ReactNative'});
|
||||
}
|
||||
|
||||
|
||||
function setUpWebSockets() {
|
||||
polyfillGlobal('WebSocket', require('WebSocket'));
|
||||
}
|
||||
|
@ -198,6 +202,7 @@ setUpPromise();
|
|||
setUpErrorHandler();
|
||||
setUpXHR();
|
||||
setUpGeolocation();
|
||||
setUpMapAndSet();
|
||||
setUpProduct();
|
||||
setUpWebSockets();
|
||||
setUpProfile();
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
|
||||
var RCTLinkingManager = require('NativeModules').LinkingManager;
|
||||
var Map = require('Map');
|
||||
var invariant = require('invariant');
|
||||
|
||||
var _notifHandlers = new Map();
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
var Map = require('Map');
|
||||
var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
|
||||
var RCTPushNotificationManager = require('NativeModules').PushNotificationManager;
|
||||
var invariant = require('invariant');
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
const EventEmitter = require('EventEmitter');
|
||||
import type EmitterSubscription from 'EmitterSubscription';
|
||||
const Map = require('Map');
|
||||
const Platform = require('Platform');
|
||||
const React = require('React');
|
||||
const StyleSheet = require('StyleSheet');
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
var Set = require('Set');
|
||||
var DeviceEventManager = require('NativeModules').DeviceEventManager;
|
||||
var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
|
||||
|
||||
|
|
Loading…
Reference in New Issue