Created
May 17, 2014 13:03
-
-
Save mewm/e5c7faa61646db1f0020 to your computer and use it in GitHub Desktop.
Syncrounous loop in javascript without dependencies
This file contains 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
var page = 2; | |
var last_page = 100; | |
(function loop() { | |
if (page <= last_page) { | |
request("/data?page=" + page, function (error, response, body) { | |
if (!error && response.statusCode == 200) { | |
store_data(body) | |
} | |
page++; | |
loop(); | |
}); | |
} | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment