Last active
July 18, 2019 08:16
-
-
Save Ariel-Rodriguez/724610eb35bf0be8edde8cdd23e3b1cd to your computer and use it in GitHub Desktop.
boilerplate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Helpers for intereview | |
(function() { | |
window.addItem = function addItem(e){ | |
var t=document.querySelector("#restaurant-list"),n=document.createElement("li");n.innerHTML="Item "+e,t.appendChild(n) | |
} | |
var next = 0; | |
window.fetchItems = function fetchItems() { | |
return new Promise((r, reject) => { | |
if (next > 7) { reject() } | |
const data = Promise.resolve(Array.from(Array(4), (e, id) => ({ id: next + id }))) | |
next=next+4; | |
setTimeout(() => r(data), 100-next); | |
})} | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment