Sentry/assets/coffee/cpu.coffee
Gregory Ballantine 9d8678e421
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Added a basic temperature display to the CPU page
2022-06-08 00:46:56 -04:00

27 lines
820 B
CoffeeScript

si = require('systeminformation')
window.onload = () ->
# Grab the static CPU information
si.cpu()
.then((data) ->
document.getElementById('cpuInfo').innerText = data.brand
document.getElementById('cpuCores').innerText = data.physicalCores
document.getElementById('cpuThreads').innerText = data.cores
document.getElementById('cpuClock').innerText = data.speed
).catch((error) ->
console.error(error)
)
# Start the CPU temperature loop
setCpuTemp()
setCpuTemp = () ->
si.cpuTemperature()
.then((data) ->
document.getElementById('cpuTemp').innerText = data.main
document.getElementById('cpuTempDisplay').children.item(0).style.height = (parseInt(data.main) + '%')
).catch((error) ->
console.error(error)
)
setTimeout(setCpuTemp, 2000)