mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-01-31 09:08:48 +08:00
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:
committed by
facebook-github-bot-3
parent
4afeb4310b
commit
cb45eaa0e8
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user