From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../zh-cn/web/api/notification/renotify/index.html | 68 ++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 files/zh-cn/web/api/notification/renotify/index.html (limited to 'files/zh-cn/web/api/notification/renotify/index.html') diff --git a/files/zh-cn/web/api/notification/renotify/index.html b/files/zh-cn/web/api/notification/renotify/index.html new file mode 100644 index 0000000000..0f7620b6c0 --- /dev/null +++ b/files/zh-cn/web/api/notification/renotify/index.html @@ -0,0 +1,68 @@ +--- +title: Notification.renotify +slug: Web/API/notification/renotify +translation_of: Web/API/Notification/renotify +--- +
+
{{APIRef("Web Notifications")}}{{AvailableInWorkers}}{{securecontext_header}}
+ +

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")}}

+ +

参见

+ + -- cgit v1.2.3-54-g00ecf