Skip to content

Instantly share code, notes, and snippets.

@mattpodwysocki
Created June 19, 2012 23:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattpodwysocki/2957213 to your computer and use it in GitHub Desktop.
Save mattpodwysocki/2957213 to your computer and use it in GitHub Desktop.
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