-
Notifications
You must be signed in to change notification settings - Fork 0
/
gitpull.html
61 lines (49 loc) · 1.06 KB
/
gitpull.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE html>
<html>
<head>
<title>miku.js - demo</title>
</head>
<body>
<button onclick="gitPull()">git pull</button>
<script src="miku.js"></script>
<script>
var miku, running;
Miku.init(function(instance) {
miku = instance;
miku.lyrics('ぎ と ぷ る');
});
function gitPull() {
if (running) return;
running = true;
noteOn(74, 300)
.then(function() {
return wait(300);
}).then(function() {
return noteOn(74, 300)
}).then(function() {
return noteOn(76, 300)
}).then(function() {
return noteOn(72, 1000)
}).then(function() {
running = false;
});
}
function noteOn(num, length) {
return new Promise(function(resolve, reject) {
miku.noteOn(num, 64, 0);
setTimeout(function() {
miku.noteOff(num, 0, 0);
resolve();
}, length);
});
}
function wait(length) {
return new Promise(function(resolve, reject) {
setTimeout(function() {
resolve();
}, length);
});
}
</script>
</body>
</html>