Instantly share code, notes, and snippets.

What would you like to do?
var element = document.querySelector('#textinput');
element.addEventListener('keyup', handleText, false);
function handleText (e) {
// Get the text
var text =;
// 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