25 lines
717 B
CoffeeScript
25 lines
717 B
CoffeeScript
|
si = require('systeminformation')
|
||
|
|
||
|
window.onload = () ->
|
||
|
# Grab the static CPU information
|
||
|
si.mem()
|
||
|
.then((data) ->
|
||
|
document.getElementById('memoryTotal').innerText = @formatBytes(data.total)
|
||
|
).catch((error) ->
|
||
|
console.error(error)
|
||
|
)
|
||
|
|
||
|
# Start the CPU temperature loop
|
||
|
getMemoryUsage()
|
||
|
|
||
|
getMemoryUsage = () ->
|
||
|
si.mem()
|
||
|
.then((data) ->
|
||
|
document.getElementById('memoryFree').innerText = @formatBytes(data.free)
|
||
|
document.getElementById('memoryActive').innerText = @formatBytes(data.active)
|
||
|
document.getElementById('memoryBuffCache').innerText = @formatBytes(data.buffcache)
|
||
|
).catch((error) ->
|
||
|
console.error(error)
|
||
|
)
|
||
|
setTimeout(getMemoryUsage, 2000)
|