'electron JS - node-notifier: Can not listen to the event when set appID

On window.

Before starting, set actions for it.

notifier.notify({
  title: 'My notification',
  message: 'Hello, there!',
  actions: ["ok","cancel"]
});

notifier.on('ok', function (notifierObject, options, event) {
  // Triggers click ok
});

notifier.on('cancel', function (notifierObject, options, event) {
  // Triggers click cancel
});


Case 1: appID = undefined => node-notifier is displayed and listen event work

  • but it is in the snore toast group. not my app.

Case 2: appID = my.app.id => node-notifier is displayed and it display is in my app group

  • but listen event not work

In my case, I want to set appID = my App ID to show my app group and listen to event work.

note: I have read the source code of node-notifier:

It passes property to SnoreToast.exe and executes it. If set appID for it, Emit Event will not work, I think so.

refer issue: https://github.com/mikaelbr/node-notifier/issues/408

If anyone have solution, plz help me. Thanks all



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source