通知:renotify 属性
注意:此功能在 Web Workers 中可用。
Notification 接口的只读属性 renotify 指定了当一个新通知替换旧通知时,是否应该通知用户,这由 Notification() 构造函数的 renotify 选项指定。
值
布尔值。默认为 false;设置为 true 时,通知会重新通知用户。
示例
以下代码片段旨在触发一个通知,该通知在被替换后会重新通知用户;创建一个简单的 options 对象,然后使用 Notification() 构造函数触发通知。
js
const options = {
body: "Your code submission has received 3 new review comments.",
renotify: true,
};
const n = new Notification("New review activity", options);
console.log(n.renotify); // true
规范
| 规范 |
|---|
| Notifications API # dom-notification-renotify |
浏览器兼容性
加载中…