【问题标题】:Sticky notification in windows not workingWindows 中的粘滞通知不起作用
【发布时间】:2019-07-07 00:03:20
【问题描述】:

node-notifier 是否支持允许通知保留在操作中心直到被用户关闭?超时和等待属性当前不起作用

【问题讨论】:

  • 你发现了吗?我也有同样的问题
  • @Brandon 您只需要转到 Windows 中的通知设置并向下滚动,直到您看到 SnoreToast 并在那里启用通知

标签: node-notifier


【解决方案1】:

它取决于操作系统。对于 mac,它提供超时和等待,但对于 windows,它不受 windows 支持。

以下是所有通知选项:

const NotificationCenter = require('node-notifier').NotificationCenter;

var notifier = new NotificationCenter({
  withFallback: false, // Use Growl Fallback if <= 10.8
  customPath: undefined // Relative/Absolute path to binary if you want to use your own fork of terminal-notifier
});

notifier.notify(
  {
    title: title,
    subtitle: subtitle,
    message: message,
    sound: false, // Case Sensitive string for location of sound file, or use one of macOS' native sounds (see below)
    icon: 'Terminal Icon', // Absolute Path to Triggering Icon
    contentImage: undefined, // Absolute Path to Attached Image (Content Image)
    open: undefined, // URL to open on Click
    wait: false, // Wait for User Action against Notification or times out. Same as timeout = 5 seconds

    // New in latest version. See `example/macInput.js` for usage
    timeout: 5, // Takes precedence over wait if both are defined.
    closeLabel: undefined, // String. Label for cancel button
    actions: undefined, // String | Array<String>. Action label or list of labels in case of dropdown
    dropdownLabel: undefined, // String. Label to be used if multiple actions
    reply: false // Boolean. If notification should take input. Value passed as third argument in callback and event emitter.
  },
  function (error, response, metadata) {
    console.log(response, metadata);
  }
);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-07-10
    • 1970-01-01
    • 2023-01-24
    • 1970-01-01
    • 2014-12-21
    • 1970-01-01
    • 2014-07-01
    相关资源
    最近更新 更多