Sentry/assets/coffee/memory.coffee

26 lines
742 B
CoffeeScript
Raw Normal View History

2022-05-26 22:28:59 -04:00
si = require('systeminformation')
window.addEventListener('load', () ->
2022-05-26 22:28:59 -04:00
# 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()
, false)
2022-05-26 22:28:59 -04:00
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)