Skip to content

Instantly share code, notes, and snippets.

@web2ls
Created August 18, 2019 14:17
Show Gist options
  • Select an option

  • Save web2ls/658682ac9f36e1b40fe9ae39f7ce26fd to your computer and use it in GitHub Desktop.

Select an option

Save web2ls/658682ac9f36e1b40fe9ae39f7ce26fd to your computer and use it in GitHub Desktop.
Hot Observable
import * as Rx from "rxjs";
const observable = Rx.Observable.fromEvent(document, 'click');
// subscription 1
observable.subscribe((event) => {
console.log(event.clientX); // x position of click
});
// subscription 2
observable.subscribe((event) => {
console.log(event.clientY); // y position of click
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment