From a7b7b419562500261221ccaae1761c0f0bf3e4d0 Mon Sep 17 00:00:00 2001 From: Giles Van Gruisen Date: Tue, 6 Dec 2016 14:40:48 -0500 Subject: [PATCH] Update methods to reflect platform information This updates the implementations of the os.type() and os.platform() methods to reflect more accurate system/platform information. os.type() has been updated to simply return 'React Native' os.platform() has been updated to return the current platform, either 'android', 'ios', or whatever else might be returned by Platform.OS --- index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 7addc05..eafec76 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,8 @@ // original: https://github.com/CoderPuppy/os-browserify var { DeviceEventEmitter, - NativeModules + NativeModules, + Platform } = require('react-native'); var RNOS = NativeModules.RNOS; @@ -34,7 +35,7 @@ exports.totalmem = function () { exports.cpus = function () { return [] }; -exports.type = function () { return 'Browser' }; +exports.type = function () { return 'React Native' }; exports.release = function () { if (typeof navigator !== 'undefined') { @@ -51,10 +52,10 @@ exports.networkInterfaces exports.arch = function () { return 'javascript' }; -exports.platform = function () { return 'browser' }; +exports.platform = function () { return Platform.OS }; exports.tmpdir = exports.tmpDir = function () { return '/tmp'; }; -exports.EOL = '\n'; \ No newline at end of file +exports.EOL = '\n';