总览

notify(idn): void

根据通知选项创建通知,并显示通知。参数id是通知的唯一标识,若之前已经有相同id的通知,再次调用notify则会更新该通知。id也可用于取消通知

示例

"nodejs";
const notification = require('notification');
 
const notificationId = 10001;
notification.notify(notificationId, {
    contentTitle: "点击触发一条新通知",
    contentText: "这是一条无法被用户清理的通知",
    ticker: "收到一条新通知",
    onContentClick: () => {
        showCounterNotification(0);
    },
    ongoing: true,
    autoCancel: true,
});

参数

名称类型默认值描述
idnumbertbd通知的唯一id,为了避免和Auto.js本身的通知冲突,建议从10000开始
nBuildNotificationOptionstbd通知选项,包括标题、内容等,参见BuildNotificationOptions

返回值

void


2023-02-15