forked from jeremyckahn/keydrown
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sandbox.html
42 lines (37 loc) · 934 Bytes
/
sandbox.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!DOCTYPE html>
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<script src="src/kd.util.js"></script>
<script src="src/kd.map.js"></script>
<script src="src/kd.key.js"></script>
<script src="src/kd.core.js"></script>
</head>
<body>
<div id="log-output">
</div>
<script>
var logOutput = document.getElementById('log-output');
function log (text) {
logOutput.innerHTML += '<pre>' + text + '</pre>';
}
kd.SPACE.down(function () {
log('The space bar is held down! Yeah!');
});
kd.SPACE.up(function () {
log('The space bar was released!');
});
kd.Z.press(function () {
log('The Z key was pressed!');
});
kd.ESC.down(function () {
log('Stopping the run loop...');
kd.stop();
});
kd.run(function () {
kd.tick();
});
</script>
</body>
</html>