Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import { fromEvent } from "rxjs";
import { debounceTime, map } from "rxjs/operators";
let span = document.querySelector("#span-location");
let button = document.querySelector("#btnStop");
let subscription = fromEvent(document, "mousemove")
map((e) => {
return { x: e.clientX, y: e.clientY };
.subscribe((e) => {
span.innerHTML = `X: ${e.x} - Y: ${e.y}`;
button.addEventListener("click", (event) => subscription.unsubscribe());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.