Press "Enter" to skip to content

Battery Status API with Javascript

Very fewer people know this API. But, this is the awesome one.

It’s called Battery Status API.

It provides information about the system’s battery charge level.

Use case

  • How about saving the contents of your blogs automatically when battery reaches less than 10%?
  • Or How about informing users to remove plug or plug in the charger at certain percentage?
  • Or turning off various functions when battery is low?

We can access this API with following method

There are even events like

chargingchangelevelchangechargingtimechangedischargingtimechange 

which are fired and can be used.

 

 

Be First to Comment

    Leave a Reply

    Your email address will not be published.