Skip to content

Instantly share code, notes, and snippets.

@NyaGarcia
Created April 24, 2020 12:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NyaGarcia/2d42baeb2f286dcd0a5d75b477dfad5b to your computer and use it in GitHub Desktop.
Save NyaGarcia/2d42baeb2f286dcd0a5d75b477dfad5b to your computer and use it in GitHub Desktop.
Subscribing to Observables created with fromEvent()
click$.subscribe(click => console.log(click));
// Output: MouseEvent {isTrusted: true}
keyPressed$.subscribe(console.log);
// Output: KeyboardEvent {isTrusted: true}
scroll$.subscribe(scroll => console.log(scroll));
// Output: UIEvent {isTrusted: true}
copie$.subscribe(console.log);
// Output: ClipboardEvent {isTrusted: true}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment