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
This commit is contained in:
parent
c998f8322b
commit
a7b7b41956
7
index.js
7
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,7 +52,7 @@ 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';
|
||||
|
|
Loading…
Reference in New Issue