Notification: dir 屬性
注意:此功能在 Web Workers 中可用。
Notification 介面的只讀屬性 dir 指示通知的文字方向,正如 Notification() 建構函式的 dir 選項所指定的。
值
一個指定文字方向的字串。可能的值為
注意:大多數瀏覽器似乎會忽略顯式的 ltr 和 rtl 設定,而是直接使用瀏覽器範圍的設定。
示例
以下程式碼片段會觸發一個通知;建立一個簡單的 options 物件,然後使用 Notification() 建構函式觸發通知。
js
const options = {
body: "Your code submission has received 3 new review comments.",
dir: "rtl",
};
const n = new Notification("New review activity", options);
console.log(n.dir); // "rtl"
規範
| 規範 |
|---|
| Notifications API # dom-notification-dir |
瀏覽器相容性
載入中…