Create a gist now

Instantly share code, notes, and snippets.

var element = document.querySelector('#textinput');
element.addEventListener('keyup', handleText, false);
function handleText (e) {
// Get the text
var text = e.target.value;
// Query the service via a Promise API
queryService(text).then(function (results) {
// Handle completion
}, function (err) {
// Handle errors
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment