簡體   English   中英

如何使用 NodeJS 在控制台中獲取用戶鼠標 Position?

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

有沒有辦法在控制台中獲取用戶鼠標坐標?

如...

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

是的,可以在 DOM 中進行協調嗎? 但這有可能在 NodeJS 控制台中獲得鼠標坐標嗎?

我知道 DOM 和 Node Js 是不同的

您可以使用 RobotJS 來獲取坐標。 這是示例:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM