DEV Community

Shyam1806
Shyam1806

Posted on • Edited on

How to get Battery Status of user Machine by using Vanilla JS

🚀 𝗻𝗮𝘃𝗶𝗴𝗮𝘁𝗼𝗿.𝗴𝗲𝘁𝗕𝗮𝘁𝘁𝗲𝗿𝘆()-> 𝘮𝘦𝘵𝘩𝘰𝘥 𝘱𝘳𝘰𝘷𝘪𝘥𝘦𝘴 𝘪𝘯𝘧𝘰𝘳𝘮𝘢𝘵𝘪𝘰𝘯 𝘢𝘣𝘰𝘶𝘵 𝘵𝘩𝘦 𝘴𝘺𝘴𝘵𝘦𝘮'𝘴 𝘣𝘢𝘵𝘵𝘦𝘳y

navigator.getbattery().then((batterystatus)=>{
console.log("status" , batterystatus)
})

Top comments (0)