简体   繁体   中英

How can I get User mouse Position in Console using NodeJS?

Is there any way to get user mouse coordinate in Console?

such as...

document.addEventListener("mousemove", (mouse) => console.log(mouse.clientX, mouse.clientY));

yeah, it is possible to get coordinated in DOM? but is this possible to get mouse coordinate in the NodeJS console?

" I know That DOM and Node Js is Different "

You may use RobotJS to get the coordinates. Here's the example:

var robot = require("robotjs");
robot.getMousePos();
// {x: 523, y: 127}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM