Set navigator.product to ReactNative

Summary: Fix for [Issue 1331](https://github.com/facebook/react-native/issues/1331). Sets navigator.product to ReactNative and navigator.productSub to the version string in package.json.

Note that the code requires package.json, which works fine in the RN packager, but webpack users will probably a need to configure a json loader in their config file.

Tested using UIExplorer and console.log printout of the product variables in xcode and Chrome debugger.
Closes https://github.com/facebook/react-native/pull/4083

Reviewed By: svcscm

Differential Revision: D2696881

Pulled By: vjeux

fb-gh-sync-id: 511446432dcd0ec658100715129c77153e743423
This commit is contained in:
Chester Wood 2015-11-25 12:43:39 -08:00 committed by facebook-github-bot-5
parent a663d4d8d5
commit e966cd1041

View File

@ -154,6 +154,11 @@ function setUpGeolocation() {
polyfillGlobal('geolocation', require('Geolocation'), GLOBAL.navigator);
}
function setUpProduct() {
Object.defineProperty(GLOBAL.navigator, 'product', {value: 'ReactNative'});
}
function setUpWebSockets() {
polyfillGlobal('WebSocket', require('WebSocket'));
}
@ -197,6 +202,7 @@ setUpPromise();
setUpErrorHandler();
setUpXHR();
setUpGeolocation();
setUpProduct();
setUpWebSockets();
setUpProfile();
setUpFlowChecker();