Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在 electron macos 环境下 使用onInputEvent 点击任意键盘程序会闪退 #9

Open
lie5860 opened this issue Mar 20, 2024 · 0 comments

Comments

@lie5860
Copy link

lie5860 commented Mar 20, 2024

单独的在 nodejs 中使用没有问题。
安装 electron main.js 填写简单的示例代码。一开始捕获好像都很正常。焦点放到了新建的窗口上。按一个按钮程序就会闪退

const {app, BrowserWindow} = require('electron');
const {onInputEvent} = require('rubick-native')
const createWindow = () => {
    const win = new BrowserWindow({
        width: 800,
        height: 600
    })
    win.show()
}
console.log(`app whenReady`);
app.whenReady().then(() => {
    createWindow();
    onInputEvent((e) => {
        console.log(`onInputEvent`);
    })
})

{
  "name": "untitled",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "electron ./main.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "rubick-native": "0.0.16-beta",
    "rubick-native-addon": "0.0.16-beta",
    "rubick-native-addon-darwin-arm64": "^0.0.15-beta"
  },
  "devDependencies": {
    "electron": "^29.1.4"
  }
}

或者有没有办法只监听鼠标的。。键盘事件跳过。。。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant