EVENT LISTENERS

Battery level: 100%


Discharging Time: Infinity hour remaining


Charging Status : Charging


Wifi Connection: connected


?


Sample code
function init(){
navigator.getBattery().then(b =>{
charge.innerText = (b.charging ? "Charging" : "Discharging")
b.onchargingchange = function() {
charge.innerText = (b.charging ? "Charging" : "Discharging")
console.log(b.charging)
}

level.innerText = b.level*100+"%"
b.onlevelchange = function(){
level.innerText = b.level*100+"%"
console.log(b.charging)
}
let hour = b.dischargingTime/3600
time.innerText = hour.toFixed(2)+" hour remaining"
})

connection.innerText = navigator.onLine ? "connected" : "disconnected"
ononline = event => connection.innerText = "connected"
onoffline = event => connection.innerText = "disconnected"
var keySet = new Set()
onkeydown = (event) =>{
keySet.add(event.key)
key.innerText = ""
for(let x of keySet){
key.innerText += x
}
}
onkeyup = (event) =>{
keySet.delete(event.key)
key.innerText = ""
for(let x of keySet){
key.innerText += x
}
}
}