Skip to content

Instantly share code, notes, and snippets.

@Ariel-Rodriguez
Last active July 18, 2019 08:16
Show Gist options
  • Save Ariel-Rodriguez/724610eb35bf0be8edde8cdd23e3b1cd to your computer and use it in GitHub Desktop.
Save Ariel-Rodriguez/724610eb35bf0be8edde8cdd23e3b1cd to your computer and use it in GitHub Desktop.
boilerplate
// 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