mikaelbr / node-notifier

A Node.js module for sending notifications on native Mac, Windows and Linux (or Growl as fallback)
MIT License
5.73k stars 322 forks source link

When we put action(custom button) on notification and click on that application gets hang. #385

Open bharat303 opened 2 years ago

bharat303 commented 2 years ago

My application is developed in electron with react. Here I'm trying to show a notification to the user to make the choice of taking a webcam snap or not. And it's working fine when I'd implemented it. But now it's not working and it hangs the whole application and also it's not quit form tray. We've to kill the process of application from the task manager only. When I've put code of notification on electron means in the main process then events of notifier like a timeout OR on action click we get a response of it. And we can do the process further based on that notification response. Now I've tried to put the code of the main process to renderer process means in react part then the application does not hang when we click on the notification action(custom button). But in that not working events of timeout OR action(custom button) event. Here is the code for showing a notification and taking a response from the user.

//code of show notification const notifyOpt = { title: 'Shoot', message: 'Your webcam screenshot will be taken.', actions: ["Click here to Deny"], sound: true, timeout: 15, wait: true, }; notifier.notify(notifyOpt); notifier.on('timeout', () => { console.log("YES TIMEOUT"); return resolve('YES'); }); notifier.on('click here to deny', () => { console.log("NO DENY"); return resolve('NO'); });

So If anyone knows the solution just give me as soon as possible. It's urgent. Thanks in advance.

Thanks, Bharat.