Skip to content

Commit

Permalink
Set navigator.product to ReactNative
Browse files Browse the repository at this point in the history
Summary: Fix for [Issue 1331](facebook#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 facebook#4083

Reviewed By: svcscm

Differential Revision: D2696881

Pulled By: vjeux

fb-gh-sync-id: 511446432dcd0ec658100715129c77153e743423
  • Loading branch information
chetstone authored and sunnylqm committed Dec 2, 2015
1 parent b1d512d commit 99f5445
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}
Expand Down Expand Up @@ -197,6 +202,7 @@ setUpPromise();
setUpErrorHandler();
setUpXHR();
setUpGeolocation();
setUpProduct();
setUpWebSockets();
setUpProfile();
setUpFlowChecker();
Expand Down

0 comments on commit 99f5445

Please sign in to comment.