WMClock.js description.
<script src="lib/WMClock.js"></script>
<script>
var clock = new WMClock([_tick], { vsync: true, start: true });
function _tick(timeStamp, deltaTime, count) {
console.log("tick:", timeStamp, deltaTime, count);
if (count === 9) {
clock.off(_tick);
clock.nth(function(timeStamp, deltaTime, count) {
console.log("nth:", timeStamp, deltaTime, count);
if (count === 9) {
clock.stop();
if (!clock.isActive()) {
console.log("finished");
} else {
console.log("error");
}
}
}, 10);
}
}
</script>
importScripts("lib/WMClock.js");
...
var WMClock = require("lib/WMClock.js");
...