-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathwebkit-05.html
More file actions
24 lines (23 loc) · 843 Bytes
/
webkit-05.html
File metadata and controls
24 lines (23 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<h1>Extending JavaScript with WebKit. Battery class.</h1>
<div id="battery-status"></div>
<script type="text/javascript">
var display = function () {
var div = document.getElementById("battery-status");
var battery_status = "Capacity: " + Battery.capacity() + "<br>";
battery_status += "Percentage: " + Battery.percentage() + "%<br>";
battery_status += "Voltage: " + Battery.voltage() + "<br>";
battery_status += "Update Time: " + Battery.updateTime() + "<br>";
battery_status += "Power supply: " + Battery.powerSupply() + "<br>";
div.innerHTML = battery_status;
}
battery = new Battery();
battery.onChange = display;
display();
</script>
</body>
</html>