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)

SurveyJS custom survey software

JavaScript Form Builder UI Component

Generate dynamic JSON-driven forms directly in your JavaScript app (Angular, React, Vue.js, jQuery) with a fully customizable drag-and-drop form builder. Easily integrate with any backend system and retain full ownership over your data, with no user or form submission limits.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay