A JavaScript implementation of a Battery Status Events draft