-
Notifications
You must be signed in to change notification settings - Fork 131
/
index.js
61 lines (46 loc) · 1.25 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// original: https://github.com/CoderPuppy/os-browserify
var {
DeviceEventEmitter,
NativeModules,
Platform
} = require('react-native');
var RNOS = NativeModules.RNOS;
// update the osInfo
var osInfo = { }
DeviceEventEmitter.addListener('rn-os-info', function (info) {
osInfo = info;
});
exports.endianness = function () { return 'LE' };
exports.hostname = function () {
if (typeof location !== 'undefined') {
return location.hostname
}
else return '';
};
exports.loadavg = function () { return [] };
exports.uptime = function () { return 0 };
exports.freemem = function () {
return Number.MAX_VALUE;
};
exports.totalmem = function () {
return Number.MAX_VALUE;
};
exports.cpus = function () { return [] };
exports.type = function () { return 'React Native' };
exports.release = function () {
if (typeof navigator !== 'undefined') {
return navigator.appVersion;
}
return '';
};
exports.networkInterfaces
= exports.getNetworkInterfaces
= function () {
return osInfo.networkInterfaces || RNOS.networkInterfaces
};
exports.arch = function () { return 'javascript' };
exports.platform = function () { return Platform.OS };
exports.tmpdir = exports.tmpDir = function () {
return '/tmp';
};
exports.EOL = '\n';