首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用JS在Mac上模拟Command + shift + esc?

问如何使用JS在Mac上模拟Command + shift + esc?
EN

Stack Overflow用户
提问于 2020-01-29 01:57:47
回答 1查看 104关注 0票数 0

我想模拟一下,如果在使用JS的web应用程序上运行MAC,按下Command + Shift + esc组合键可以停止屏幕录制

EN

回答 1

Stack Overflow用户

发布于 2020-01-29 02:31:59

您可以向文档中添加keydown事件侦听器。

代码语言:javascript
复制
document.addEventListener('keydown', function (event) {
  // Check that the key that is down is the “Escape” key
  // And that the meta key is down (cmd on Mac, the windows key on Windows)
  // And that the shift key is also down
  if (event.key === 'Escape' && event.metaKey && event.shiftKey) {
    // Do things!
  }
});
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59954525

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档