Skip to content

Instantly share code, notes, and snippets.

@j3ck
Created June 21, 2019 07:49
Show Gist options
  • Save j3ck/2f2a687ac5e30ac29d3107a4a630c8e0 to your computer and use it in GitHub Desktop.
Save j3ck/2f2a687ac5e30ac29d3107a4a630c8e0 to your computer and use it in GitHub Desktop.
function getMirror(mirrors, offset) {
Promise.all(
mirrors.slice(offset * 6, (offset + 1) * 6).map((mirror) => checkMirror(mirror))
).then(() => {
setTimeout(() => getMirror(mirrors, offset + 1), 0)
})
.catch(err => console.log(err));
}
fetch(`${basePath}/mirrors.json`)
.then(response => {
response.json().then(mirrorsData => {
getMirror(mirrorsData, 0);
});
})
.catch(err => console.log(err));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment