node-notifier icon indicating copy to clipboard operation
node-notifier copied to clipboard

Event click open few card in browser

Open major697 opened this issue 5 years ago • 6 comments

Hi I using Electron: 5.0.8 node-notifier 5.4.3

when the notification appears for example 3 times and the user clicks on it, then 3 tabs in the browser will open:

const url = 'https://www.google.com/'
notifier.on('click', (notifierObject, options) => {
    console.log("click!");
    require('electron').shell.openExternal(url);
});

console.log will also return "click!" 3 times.

major697 avatar Nov 08 '19 08:11 major697

Hi @major697! I noticed you commented on a couple other issues related to this, and it sounds like you've possibly gotten it taken care of. If your project happens to be open source I'd love to see what your electron setup looks like since we don't currently have any examples/setup for testing through that.

jnielson94 avatar Nov 14 '19 21:11 jnielson94

I called removeAllListeners() on notifier before calling it again. It worked for me.

pjebs avatar Dec 24 '19 22:12 pjebs

@pjebs Can you show me your code. I want see how you used removeAllListeners().

major697 avatar Feb 26 '20 08:02 major697

I actually reverted back to the standard notification that is part of electron so I can't remember.

See my comments here: https://github.com/electron/electron/issues/21610#issuecomment-569857509 which I believe is similar to what I did.

pjebs avatar Feb 26 '20 08:02 pjebs

Or maybe it was something like this:???

const url = 'https://www.google.com/'
notifier.removeAllListeners()
notifier.on('click', (notifierObject, options) => {
    console.log("click!");
    require('electron').shell.openExternal(url);
});

pjebs avatar Feb 26 '20 08:02 pjebs

@pjebs it seems like the answer works. Thank you ;)

major697 avatar Feb 26 '20 08:02 major697