我有一个问题,实验电子通知 API不提交“点击”事件,或者我只是使用错误,但是我想清楚这是在主进程中运行的新通知系统,而不是在渲染器进程中运行:
我的代码:
notification = new Notification({title: "Message Received",body: "message body"}).show()
// The above works and a notification gets made
notification.on('click', (event, arg)=>{
console.log("clicked")
})
// The above gives an error about 'on' not being defined
Run Code Online (Sandbox Code Playgroud)
尝试的事情:
notification.once('click', (event, arg)=>{
console.log("clicked")
})
Run Code Online (Sandbox Code Playgroud)
notification.onclick = () =>{
console.log("clicked")
}
Run Code Online (Sandbox Code Playgroud)