Electron with node-notifier display windows 10 notification

后端 未结 5 920
灰色年华
灰色年华 2021-01-03 05:56

I\'m trying to make a simple app that should display notification when button is clicked. The problem is that the notification does not show, but console.logs are showing. S

5条回答
  •  佛祖请我去吃肉
    2021-01-03 06:28

    You don't need to use IPC and send notifications from the main process, this is supported from the renderer process using the HTML5 notification API.

    let myNotification = new Notification('Title', {
      body: 'Lorem Ipsum Dolor Sit Amet'
    })
    
    myNotification.onclick = () => {
      console.log('Notification clicked')
    }
    

提交回复
热议问题