Skip to content

Latest commit

 

History

History
39 lines (30 loc) · 956 Bytes

File metadata and controls

39 lines (30 loc) · 956 Bytes

Tips

// querySelectorAll return a NodeList, an array-like list
var nodes = document.querySelectorAll('a');

// In order to iterate it, we cannot use forEach, but we can sort of duck type it
[].forEach.call(nodes, function(el, i) {
});
JSON.stringify(json, null, 4)

Netflix autocomplete search

http://www.youtube.com/watch?v=XRYN2xt11Ek

var searchResultSets = keyPresses
  .throttle(250)
  .map(function(key) {
    getJSON("/searchResults?q=" + input.value).retry(3)
      .takeUtil(keyPresses)
  }).concatAll();
  
searchResultSets.forEach(function(resultSet) {
  updateSearchResults(resultSet);
});