Skip to content

Instantly share code, notes, and snippets.

@AJFaraday
Created May 17, 2021 10:48
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 AJFaraday/fb40109fcd91da0e579634c65ede70a8 to your computer and use it in GitHub Desktop.
Save AJFaraday/fb40109fcd91da0e579634c65ede70a8 to your computer and use it in GitHub Desktop.
Conversion template?
class StripSearch {
static months = {
'01': 'January',
...
}
static setup_events() {
document.getElementById("query").addEventListener('keyup', StripSearch.run_search);
}
static run_search(e) {
e.preventDefault();
search = new StripSearch(document.getElementById("query").value)
}
constructor(searchTerm) {
this.query = searchTerm;
this.results = this.run_search(searchTerm);
}
// formerly query()
run_search(searchTerm) {
...
r.onreadystatechange = () => start(r); // Inline function definition
}
// formerly start(r)
complete_search(request) {
..
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment