Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import { fromEvent } from "rxjs";
import { debounceTime, map } from "rxjs/operators";
let span = document.querySelector("#span-location");
fromEvent(document, "mousemove")
.pipe(
map((e) => {
return { x: e.clientX, y: e.clientY };
}),
debounceTime(100)
)
.subscribe((e) => {
span.innerHTML = `X: ${e.x} - Y: ${e.y}`;
});
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.