How to keep the notification on until the user press click on node-notifier?

370 views Asked by At

I am using windows 10 and I try to make the notification stay on until the user press click on the notification, but no matter what I try the notification disappear after some time, there is some way to make this with the library: node-notifier or with another library? enter image description here

const notifier = require("node-notifier");
const path = require("path");

var isClickNote = false;

function sendNote() {
  notifier.notify(
    {
      title: "My awesome title",
      message: "Hello from node, Mr. User!",
      icon: path.join(__dirname, "coulson.jpg"), // Absolute path (doesn't work on balloons)
      sound: true, // Only Notification Center or Windows Toasters
      wait: true, // Wait with callback, until user action is taken against notification, does not apply to Windows Toasters as they always wait or notify-send as it does not support the wait option
    },
    function (err, response, metadata) {
      // Response is response from notification
      // Metadata contains activationType, activationAt, deliveredAt
    }
  );

  notifier.on("click", function (notifierObject, options, event) {
    isClickNote = true;
    // console.log("notifierObject:", notifierObject);
    // Triggers if `wait: true` and user clicks notification
  });

  notifier.on("timeout", function (notifierObject, options) {
    // Triggers if `wait: true` and notification closes
  });
}
sendNote();

0

There are 0 answers