Skip to content

Instantly share code, notes, and snippets.

@Armenvardanyan95
Created June 18, 2020 09:08
Show Gist options
  • Save Armenvardanyan95/966197d8c33bd18fe101a0f65c67c620 to your computer and use it in GitHub Desktop.
Save Armenvardanyan95/966197d8c33bd18fe101a0f65c67c620 to your computer and use it in GitHub Desktop.
fromEvent(document.querySelector('input'), 'input').pipe(
debounceTime(300),
map(event => (event.target as HTMLInputElement).value),
switchMap(query => getData(query)),
).subscribe(console.log);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment