Skip to content

Commit

Permalink
update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
aksakalli committed Jul 30, 2019
1 parent 6c73da3 commit ea0661b
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 430 deletions.
20 changes: 9 additions & 11 deletions lib/monitor/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@ function Net(sparkline) {
this.netData = [Array(61).fill(0), Array(61).fill(0)];

si.networkInterfaceDefault(iface => {
this.defaultIface = iface;
si.networkStats(iface, data => {
this.updateData(data);
});

this.interval = setInterval(() => {
var that = this;
var updater = function() {
si.networkStats(iface, data => {
this.updateData(data);
})
}, 1000);
that.updateData(data[0]);
});
}
updater();
this.interval = setInterval(updater, 1000);
})
}

Expand All @@ -35,12 +33,12 @@ Net.prototype.updateData = function(data) {
rx_label = 'Receiving: ' +
utils.humanFileSize(rx_sec) +
'/s \nTotal received: ' +
utils.humanFileSize(data['rx']);
utils.humanFileSize(data['rx_bytes']);

tx_label = 'Transferring: ' +
utils.humanFileSize(tx_sec) +
'/s \nTotal transferred: ' +
utils.humanFileSize(data['tx']);
utils.humanFileSize(data['tx_bytes']);

this.sparkline.setData([rx_label, tx_label], this.netData);
this.sparkline.screen.render();
Expand Down
Loading

0 comments on commit ea0661b

Please sign in to comment.