Created
June 9, 2018 22:43
-
-
Save ssougnez/4dc2d144088bf41bf2b089b94e8c19f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { fromEvent } from "rxjs"; | |
import { map } from "rxjs/operators"; | |
let span = document.querySelector("#span-location"); | |
fromEvent(document, "mousemove") | |
.pipe( | |
map((e) => { | |
return { x: e.clientX, y: e.clientY }; | |
}) | |
) | |
.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