2022-05-25 16:23:42 -04:00
|
|
|
si = require('systeminformation')
|
|
|
|
|
2022-10-28 01:06:09 -04:00
|
|
|
window.addEventListener('load', () ->
|
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()
|
2022-10-28 01:06:09 -04:00
|
|
|
, false)
|
2022-05-26 22:07:18 -04:00
|
|
|
|
|
|
|
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++
|
|
|
|
).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)
|
|
|
|
)
|