--- title: Notification.renotify slug: Web/API/notification/renotify translation_of: Web/API/Notification/renotify ---
renotify 是 {{domxref("Notification")}} 接口的只读属性,如果有新的通知替换了一个旧的通知,这个属性指明用户是否应该重新收到通知。它也可以通过{{domxref("Notification.Notification","Notification()")}} 构造函数的 renotify option 来指定。
var renotify = Notification.renotify;
{{domxref("Boolean")}}. 默认为false;设为 true 将会重新通知用户。
以下代码片段用于在一个通知被替换以后触发通报以重新通知用户;它创建一个简单的 options 对象,然后使用Notification() 构造函数触发通报。
var options = {
body: 'Do you like my body?',
tag: 'renotify',
renotify: true
}
var n = new Notification('Test notification',options);
n.renotify // should return true
renotify 覆盖通知选项必须搭配 tag 标签选项进行使用,否则会收到错误通知。
Notifications which set the renotify flag must specify a non-empty tag.
| 规范 | 状态 | 备注 |
|---|---|---|
| {{SpecName('Web Notifications','#dom-notification-renotify','renotify')}} | {{Spec2('Web Notifications')}} | Living standard |
{{Compat("api.Notification.renotify")}}