Skip to content

Instantly share code, notes, and snippets.

@craigp
Last active August 29, 2015 14:08
Show Gist options
  • Save craigp/a121e74f953643ffccb0 to your computer and use it in GitHub Desktop.
Save craigp/a121e74f953643ffccb0 to your computer and use it in GitHub Desktop.
// var threadsToLoad = [],
// _thread;
// restrict number of threads to load
var threadsToLoad = (function _getThreads(loadThreads, allThreads) {
var thread = allThreads.shift();
if (thread && loadThreads.length < settings.maxSourceListItemsToCache) {
loadThreads.push(thread);
return _getThreads(loadThreads, allThreads);
} else return loadThreads;
})([], threads);
// restrict number of threads to load
// while (threadsToLoad.length < settings.maxSourceListItemsToCache) {
// _thread = threads.shift();
// if (_thread)
// threadsToLoad.push(_thread);
// else
// break;
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment