Search code examples
node.jsconsolemouse

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 "


Solution

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

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