Created
October 27, 2015 00:08
-
-
Save balanza/93fde3efc0e279813246 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //this is the "debounced" search | |
| // it runs after 500ms from its first call, just once in 500ms | |
| var search = _.debounce(function(){ | |
| var keyword = document.getElementById('searchbox').value; | |
| doSearch(keyword); //this performs server call and displays results | |
| }, 500); | |
| //this is the keyboard event | |
| document.getElementById('searchbox').addEventListener('keypress', search); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment