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 |
浏览器兼容性
加载中…