samdutton / simpl

Simplest possible examples of HTML, CSS and Javascript:
https://simpl.info
Apache License 2.0
5.19k stars 1.64k forks source link

Update the battery example to match the spec #54

Closed leops closed 10 years ago

leops commented 10 years ago

In the latest version of the Battery Status API draft (http://www.w3.org/TR/battery-status/), a BatteryManager object is obtained by calling navigator.getBattery() , which return a promise resolving into the object. This version of the draft is the one currently implemented in Chrome >= 38, and this PR adds should make the battery example compatible with these changes (while retaining backward compatibility with the old navigator.battery).

samdutton commented 10 years ago

Thanks for heads-up and code!