Skip to content

Instantly share code, notes, and snippets.

@EvanBurbidge
Created December 15, 2021 19:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EvanBurbidge/1e6e1f65d9922b04423186d0457b07d5 to your computer and use it in GitHub Desktop.
Save EvanBurbidge/1e6e1f65d9922b04423186d0457b07d5 to your computer and use it in GitHub Desktop.
const subscribeToPHoneData = async () => {
// fetch the phones url
const phones = await getData(PHONES_URL);
const phoneAvailabilityCheck = setInterval(async () => {
const { unavailableIds } = await getData(AVAILABILITY_URL);
changePhonesStatus(phones, unavailable);
// should return an object with the updated phone system
/*
if(someCondition) { clearInterval(phoneAvailabilityCheck) }
*/
}, 1000);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment