Created
September 6, 2012 12:46
-
-
Save byrichardpowell/3655898 to your computer and use it in GitHub Desktop.
Method Optimisation
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
// Cycle through these URL's | |
// We update the models URL using these | |
// Then we fetch data using it | |
var nextUrl = function() { | |
var urls = [ | |
'js/_data/api/tags/index.json%3frange=21-30', | |
'js/_data/api/tags/index.json%3frange=31-40', | |
'js/_data/api/tags/index.json%3frange=0-10', | |
'js/_data/api/tags/index.json%3frange=11-20' | |
] | |
var i = 0; | |
nextUrl = function() { | |
i++ | |
if ( i === urls.length ) i = 0; | |
return urls[ i ] | |
} | |
return nextUrl(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment