Created
October 16, 2010 16:27
-
-
Save chapel/629993 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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