Skip to content

Instantly share code, notes, and snippets.

@dmitryshimkin
Last active August 29, 2015 14:09
Show Gist options
  • Select an option

  • Save dmitryshimkin/9d84654e8500c5d5d0db to your computer and use it in GitHub Desktop.

Select an option

Save dmitryshimkin/9d84654e8500c5d5d0db to your computer and use it in GitHub Desktop.
var race = new PromiseRace();
var gotData = function (data) {
resultList.innerHTML = data.map(function(item){
return '<li>' + item.text + '</li>';
});
}
someField.onkeyup = function() {
var promise = race.add($.get('/some/url?query=' + someField.value));
promise.then(gotData);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment