Skip to content

Instantly share code, notes, and snippets.

@munro
Created November 3, 2011 21:32
Show Gist options
  • Save munro/1337837 to your computer and use it in GitHub Desktop.
Save munro/1337837 to your computer and use it in GitHub Desktop.
seriesCoarse
function seriesCoarse(first, second, interval, obj) {
var start = (new Date()).getTime();
interval = interval || 1000;
obj = obj || this;
first.call(obj, function () {
setTimeout(function () {
}, interval - ((new Date()).getTime() - start) % interval);
});
}
socket.on('login', function (name, password) {
var compare;
seriesCoarse(function (next) {
redis.get('user:' + name + ':pass', function (value) {
compare = password === value;
next();
});
}, function () {
socket.emit({login: compare});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment