I'm simply send notifications using the node-notifier package. Also, when I click on the notification, it has to go to a link. But I can't listen the click event. The events provided by the package do nothing. This is my code:
const notifier = require("node-notifier");
const open = require("open");
notifier.notify({
title: "Stackoverflow",
message: "A message",
wait: true,
open: "https://stackoverflow.com/",
});
notifier.on("click", function (notifierObject, options, event) {
open("https://sindresorhus.com");
});
And this is my notification:
I can use any other package. I just want to listen click event.
@user120242's answer works but does not works clicking after the notification disappears. Is there any way? I added a gif.