通知: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 |
瀏覽器相容性
載入中…