Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Who seriously thought the Battery Status API was a good idea? Someone thought this was useful enough to write a spec for it...


I suppose you're doing what might be a resource intensive task and want to be sure you don't kill the battery.

Granted I get folks might feel a rando website that is resource intensive would be horrific, but maybe we're talking about some specific web app / use case.


Even so, I think battery API is not the proper way to do it. Some sort of interrupt command (like UNIX has) may be better.


Emergency tools could benefit from knowing if the device was about to die or not, like the Tinder SOS app, government emergency tools, etc. Imagine sending a quick POST request to save session state or whatever before it dies.


Fullscreen games providing a battery indicator is always nice.


Seems legit, although that should probably be the OSes job to overlay that


That has its own set of challenges -- now you have to design your game so that the battery indicator doesn't cover up an important part of the game. Also, what if the OS allows it to be configurable location/size, etc.


I was imagining a pop-up saying "your battery is getting low"


Sounds like a job for safe area insets.


Thanks! I did not know about these before. It looks like a step in the right direction. Though what would be the next step? It seems like there would still the complexity of laying out all the controls/HUD (or other visual elements) in the game.


Well, it's not going to fix the layout for you, but it'll ensure that it won't end up under a curve of the screen or behind some UI protrusion.


> now you have to design your game so that the battery indicator doesn't cover up an important part of the game

You should not be able to do that; It's a feature that you cannot do that.


Mostly agreed. However, if the screen is split into the system area and document area, then the battery indicator could go in the system area, and the game need not know where it is; only the size of the document area needs to be known by the game (and not whether or not the system area is present, what it contains, etc).


? You should not be able to re-layout your visual elements in the game if the battery indicator hides it?


Agreed. Maybe only useful for laptops used as 'kiosks' (launching directly to app without a window manager)?




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: