diff options
Diffstat (limited to 'files/zh-cn/web/api/notification/renotify/index.html')
-rw-r--r-- | files/zh-cn/web/api/notification/renotify/index.html | 68 |
1 files changed, 68 insertions, 0 deletions
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 +--- +<div> +<div>{{APIRef("Web Notifications")}}{{AvailableInWorkers}}{{securecontext_header}}</div> + +<p><code>renotify</code> 是 {{domxref("Notification")}} 接口的只读属性,如果有新的通知替换了一个旧的通知,这个属性指明用户是否应该重新收到通知。它也可以通过{{domxref("Notification.Notification","Notification()")}} 构造函数的 <code>renotify</code> option 来指定。</p> +</div> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox">var renotify = Notification.renotify; +</pre> + +<h3 id="值">值</h3> + +<p>{{domxref("Boolean")}}. 默认为<code>false</code>;设为 <code>true</code> 将会重新通知用户。</p> + +<h2 id="例子">例子</h2> + +<p>以下代码片段用于在一个通知被替换以后触发通报以重新通知用户;它创建一个简单的 <code>options</code> 对象,然后使用<code>Notification()</code> 构造函数触发通报。</p> + +<pre class="brush: js">var options = { + body: 'Do you like my body?', + tag: 'renotify', + renotify: true +} + +var n = new Notification('Test notification',options); + +n.renotify // should return true</pre> + +<h2 id="使用注意">使用注意</h2> + +<p>renotify 覆盖通知选项必须搭配 tag 标签选项进行使用,否则会收到错误通知。</p> + +<pre>Notifications which set the renotify flag must specify a non-empty tag.</pre> + +<h2 id="规范">规范</h2> + +<table> + <tbody> + <tr> + <th scope="col">规范</th> + <th scope="col">状态</th> + <th scope="col">备注</th> + </tr> + <tr> + <td>{{SpecName('Web Notifications','#dom-notification-renotify','renotify')}}</td> + <td>{{Spec2('Web Notifications')}}</td> + <td>Living standard</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + + + +<p>{{Compat("api.Notification.renotify")}}</p> + +<h2 id="参见">参见</h2> + +<ul> + <li><a href="/en-US/docs/Web/API/Notifications_API/Using_the_Notifications_API">使用通知API</a></li> +</ul> |