Skip to content

Instantly share code, notes, and snippets.

@chapel
Created October 16, 2010 16:27
Show Gist options
  • Save chapel/629993 to your computer and use it in GitHub Desktop.
Save chapel/629993 to your computer and use it in GitHub Desktop.
function onData(page) {
parseData(page, function(hasMore) {
if (
pagePush = pages[0]+1
pages.push(pagePush)
console.log('onData: '+pages[0]);
getPage(pages.shift());
}
else console.log('no more pages');
});
}
function parseData(data, callback) {
var games = data.RecentGames,
count = games.length;
games.some(function(game) {
var gameId = game.GameId,
gameDate = new Date(parseInt(game.GameTimestamp.substr(6))),
checkDate = new Date('01 Oct 2010 03:00:00 PST');
if (gameDate > checkDate) {
console.log(gameDate);
count--;
if (count <= 0) callback(true);
}
else {
callback(false);
return true;
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment