extended getDynamicData() (windows), updated docs
This commit is contained in:
+36
-48
@@ -130,35 +130,29 @@ function getStaticData(callback) {
|
||||
|
||||
data.version = version();
|
||||
|
||||
system().then(res => {
|
||||
data.system = res;
|
||||
osInfo.osInfo().then(res => {
|
||||
data.os = res;
|
||||
osInfo.versions().then(res => {
|
||||
data.versions = res;
|
||||
cpu.cpu().then(res => {
|
||||
data.cpu = res;
|
||||
cpu.cpuFlags().then(res => {
|
||||
data.cpu.flags = res;
|
||||
graphics.graphics().then(res => {
|
||||
data.graphics = res;
|
||||
network.networkInterfaces().then(res => {
|
||||
data.net = res;
|
||||
mem.memLayout().then(res => {
|
||||
data.memLayout = res;
|
||||
filesystem.diskLayout().then(res => {
|
||||
data.diskLayout = res;
|
||||
if (callback) { callback(data) }
|
||||
resolve(data);
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
Promise.all([
|
||||
system(),
|
||||
osInfo.osInfo(),
|
||||
osInfo.versions(),
|
||||
cpu.cpu(),
|
||||
cpu.cpuFlags(),
|
||||
graphics.graphics(),
|
||||
network.networkInterfaces(),
|
||||
mem.memLayout(),
|
||||
filesystem.diskLayout()
|
||||
]).then(res => {
|
||||
data.system = res[0];
|
||||
data.os = res[1];
|
||||
data.versions = res[2];
|
||||
data.cpu = res[3];
|
||||
data.cpu.flags = res[4];
|
||||
data.graphics = res[5];
|
||||
data.net = res[6];
|
||||
data.memLayout = res[7];
|
||||
data.diskLayout = res[8];
|
||||
if (callback) { callback(data) }
|
||||
resolve(data);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -190,7 +184,7 @@ function getDynamicData(srv, iface, callback) {
|
||||
|
||||
// use closure to track ƒ completion
|
||||
let functionProcessed = (function () {
|
||||
let totalFunctions = (_windows ? 7 : 14);
|
||||
let totalFunctions = (_windows ? 10 : 14);
|
||||
|
||||
return function () {
|
||||
if (--totalFunctions === 0) {
|
||||
@@ -241,31 +235,25 @@ function getDynamicData(srv, iface, callback) {
|
||||
});
|
||||
}
|
||||
|
||||
if (!_windows) {
|
||||
cpu.currentLoad().then(res => {
|
||||
data.currentLoad = res;
|
||||
functionProcessed();
|
||||
});
|
||||
}
|
||||
cpu.currentLoad().then(res => {
|
||||
data.currentLoad = res;
|
||||
functionProcessed();
|
||||
});
|
||||
|
||||
cpu.cpuTemperature().then(res => {
|
||||
data.temp = res;
|
||||
functionProcessed();
|
||||
});
|
||||
|
||||
if (!_windows) {
|
||||
network.networkStats(iface).then(res => {
|
||||
data.networkStats = res;
|
||||
functionProcessed();
|
||||
});
|
||||
}
|
||||
network.networkStats(iface).then(res => {
|
||||
data.networkStats = res;
|
||||
functionProcessed();
|
||||
});
|
||||
|
||||
if (!_windows) {
|
||||
network.networkConnections().then(res => {
|
||||
data.networkConnections = res;
|
||||
functionProcessed();
|
||||
});
|
||||
}
|
||||
network.networkConnections().then(res => {
|
||||
data.networkConnections = res;
|
||||
functionProcessed();
|
||||
});
|
||||
|
||||
mem.mem().then(res => {
|
||||
data.mem = res;
|
||||
|
||||
Reference in New Issue
Block a user