Skip to content

Instantly share code, notes, and snippets.

@Dunkelheit
Created October 17, 2020 11:51
Show Gist options
  • Save Dunkelheit/cbaacbc4ca304a289fe920b289f49718 to your computer and use it in GitHub Desktop.
Save Dunkelheit/cbaacbc4ca304a289fe920b289f49718 to your computer and use it in GitHub Desktop.
pending-promise-recycler - step 1
const fetchSomethingExpensive = (arg1, arg2) => {
return new Promise(resolve => {
// Assume there is a call to a 3rd party API here -it will take ~300 ms. to respond
setTimeout(() => {
resolve({ foo: 'bar' });
}, 300);
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment