--- title: Notification.dir slug: Web/API/Notification/dir tags: - API - DOM - Notification - Notifications - Notifications API - Property - Reference - dir - プロパティ - 通知 translation_of: Web/API/Notification/dir ---
{{APIRef("Web Notifications")}}{{AvailableInWorkers}}{{securecontext_header}}
dir は {{domxref("Notification")}} インターフェイスの読取専用プロパティで、 {{domxref("Notification.Notification","Notification()")}} コンストラクターの dir オプションで指定されたテキストの書字方向を示します。
var dir = Notification.dir;
書字方向を指定する {{domxref("DOMString")}} です。取りうる値は次の通りです。
auto: ブラウザーの言語設定の動作に合わせます (既定値)。ltr: 左書きrtl : 右書き注: 多くのブラウザーは明示的な ltr や rtl の設定を無視し、ブラウザー全体の設定どおりに実行するようです。
次のスニペットは通知を発行するためのものです。単純な options オブジェクトが生成され、通知が Notification() コンストラクターを使用して発行されます。
var options = {
body: 'Do you like my body?',
dir: 'rtl'
}
var n = new Notification('Test notification',options);
console.log(n.dir) // should return 'rtl'
| 仕様書 | 状態 | 備考 |
|---|---|---|
| {{SpecName('Web Notifications','#dom-notification-dir','dir')}} | {{Spec2('Web Notifications')}} | Living standard |
{{Compat("api.Notification.dir")}}