Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var async = require('async');
- var before = Date.now();
- async.whilst(always, gameloop, stop);
- function always() { return true; }
- function gameloop(next)
- {
- var after = Date.now();
- var dt = after - before;
- if (dt >= 500)
- {
- console.log("yipee!");
- before = after;
- }
- process.nextTick(next);
- }
- function stop()
- {
- console.log("loop has stopped for some reason when it shouldn't")
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement