Skip to content

Instantly share code, notes, and snippets.

View jsphkhan's full-sized avatar
🎯
Focusing

Joseph Khan jsphkhan

🎯
Focusing
View GitHub Profile
fetchSynchronous(fetchFactories) {
// we have to fetch the data sequentially in order to avoid overloading the server
// this array will hold the data from each response
const data = [];
// init a promise chain
let p = Promise.resolve();
// execute promises in a chain
fetchFactories.forEach((fetchFactory) => {