-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
executable file
·86 lines (74 loc) · 2.7 KB
/
index.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<html>
<head>
<script src="ChronoJs-TimeBeats.js"></script>
</head>
<body> TimeBeats Standalone.
<script>
window.setTimeout( function () {
var timer = new CRNJS.TimeBeats( {
ticks: 5,
period: 1000,
callback: function ( lastBeat, startCall ) {
console.log('---- timer: ' + timer.getRemainingTime() + 'startCall: ' + startCall + ' lastBeat: ' + lastBeat );
}
});
console.log('---- start: ' + timer.getRemainingTime());
timer.start( { callBackOnStart: true } );
console.log('---- start: ' + timer.getRemainingTime());
window.setTimeout( function () {
console.log('pause1: ' + timer.getRemainingTime() );
timer.pause();
console.log('pause1: ' + timer.getRemainingTime() );
}, 300);
window.setTimeout( function () {
console.log('resume1: ' + timer.getRemainingTime());
timer.resume();
console.log('resume1: ' + timer.getRemainingTime() );
}, 500);
window.setTimeout( function () {
console.log('pause2: ' + timer.getRemainingTime() );
timer.pause();
console.log('pause2: ' + timer.getRemainingTime() );
}, 1200);
window.setTimeout( function () {
console.log('resume2: ' + timer.getRemainingTime());
timer.resume();
console.log('resume2: ' + timer.getRemainingTime() );
}, 1500);
//======================
window.setTimeout( function () {
console.log('pause3: ' + timer.getRemainingTime() );
timer.pause();
console.log('pause3: ' + timer.getRemainingTime() );
}, 2000);
window.setTimeout( function () {
console.log('pause4: ' + timer.getRemainingTime() );
timer.pause();
console.log('pause4: ' + timer.getRemainingTime() );
}, 2200);
window.setTimeout( function () {
console.log('resume3: ' + timer.getRemainingTime());
timer.resume();
console.log('resume3: ' + timer.getRemainingTime() );
}, 2500);
window.setTimeout( function () {
console.log('resume4: ' + timer.getRemainingTime());
timer.resume();
console.log('resume4: ' + timer.getRemainingTime() );
}, 2600);
window.setTimeout( function () {
console.log('add 5 Ticks remaining ticks : ' + timer.getRemainingTicks() );
console.log('add 5 Ticks remaining time : ' + timer.getRemainingTime() );
timer.addRemainingTicks( 5 );
console.log('add 5 Ticks remaining ticks : ' + timer.getRemainingTicks() );
console.log('add 5 Ticks remaining time : ' + timer.getRemainingTime() );
}, 3000 );
window.setTimeout( function () {
console.log('change period : ' + timer.getRemainingTime() );
timer.setPeriod( 500 );
console.log('change period : ' + timer.getRemainingTime() );
}, 3500 );
}, 2000 );
</script>
</body>
</html>