简体   繁体   English

如何使用 NodeJS 在控制台中获取用户鼠标 Position?

[英]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?是的,可以在 DOM 中进行协调吗? but is this possible to get mouse coordinate in the NodeJS console?但这有可能在 NodeJS 控制台中获得鼠标坐标吗?

" I know That DOM and Node Js is Different " 我知道 DOM 和 Node Js 是不同的

You may use RobotJS to get the coordinates.您可以使用 RobotJS 来获取坐标。 Here's the example:这是示例:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 NodeJS 中,如何在不将用户的按键回显到控制台的情况下从输入中获取密码? - In NodeJS, how can I get a password from input without the user's keypresses being echoed to the console? 我如何从CMD控制台nodeJS获取数据? - How i can get the data from CMD console nodeJS? 如何使用nodejs在控制台中打印utf8字符串 - How can I print a utf8 string in the console using nodejs 如何使用IAP和People API获取用户的Google帐户照片? (首选NodeJS) - How can I get a user's Google account photo using IAP and the People API? (NodeJS preferred) 如何使用 nodejs 对电子邮件进行身份验证? 我收到一封关于用户提交的电子邮件的电子邮件,然后我点击我端的一个链接来验证这封电子邮件 - How can I authenticate an email using nodejs? I get an email for user submitted email, then I click a link on my end to verify this email 如何使用 nodejs 在用户主目录中创建目录? - How can I create a directory in user home using nodejs? 如何从控制台Node.js获得多个输入值 - How can I get input value more than one from console nodejs 我可以在nodejs中获取console.table的字符串值吗? - Can I get the string value of console.table in nodejs? 如何使用 puppeteer 获得鼠标 position - How to get mouse position with puppeteer 我可以在NodeJs中模拟控制台吗? - Can I mock console in NodeJs?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM