2022-05-25 16:23:42 -04:00
|
|
|
si = require('systeminformation')
|
|
|
|
|
|
|
|
window.onload = () ->
|
2022-05-26 22:07:18 -04:00
|
|
|
# Set the option selector to trigger an info grab on element change
|
|
|
|
document.getElementById('gpuSelector').addEventListener('change', () ->
|
|
|
|
updateGpuInfo(@value)
|
|
|
|
)
|
|
|
|
|
|
|
|
# Load GPUs into the selector
|
|
|
|
loadGpus()
|
|
|
|
|
|
|
|
# Run the updateGpuInfo function with the default value of 0
|
|
|
|
updateGpuInfo()
|
|
|
|
|
|
|
|
loadGpus = () ->
|
|
|
|
si.graphics()
|
|
|
|
.then((data) ->
|
|
|
|
i = 0
|
|
|
|
while i < data.controllers.length
|
|
|
|
optionElem = document.createElement('option')
|
|
|
|
optionElem.innerText = data.controllers[i].model
|
2022-06-08 00:46:56 -04:00
|
|
|
optionElem.setAttribute('value', i)
|
|
|
|
document.getElementById('gpuSelector').appendChild(optionElem)
|
2022-05-26 22:07:18 -04:00
|
|
|
i++
|
2022-08-23 19:13:49 -04:00
|
|
|
console.log(data)
|
2022-05-26 22:07:18 -04:00
|
|
|
).catch((error) ->
|
|
|
|
console.error(error)
|
|
|
|
)
|
|
|
|
|
|
|
|
updateGpuInfo = (gpuId = 0) ->
|
2022-05-25 16:23:42 -04:00
|
|
|
si.graphics()
|
|
|
|
.then((data) ->
|
2022-05-26 22:07:18 -04:00
|
|
|
document.getElementById('gpuInfo').innerText = data.controllers[gpuId].model
|
|
|
|
document.getElementById('gpuVendor').innerText = data.controllers[gpuId].vendor
|
|
|
|
document.getElementById('gpuVram').innerText = data.controllers[gpuId].vram + 'MB'
|
|
|
|
document.getElementById('gpuBus').innerText = data.controllers[gpuId].bus
|
2022-05-25 16:23:42 -04:00
|
|
|
).catch((error) ->
|
|
|
|
console.error(error)
|
|
|
|
)
|