Notification.timestamp
注: この機能は Web Worker 内で利用可能です
安全なコンテキスト用: この機能は一部またはすべての対応しているブラウザーにおいて、安全なコンテキスト (HTTPS) でのみ利用できます。
timestamp
は Notification
インターフェイスの読取専用プロパティで、 Notification()
コンストラクターの timestamp
オプションで指定された DOMTimeStamp
を返します。
通知のタイムスタンプは、 1970/01/01 00:00:00 UTC からの経過ミリ秒数で、通知が作成された時刻、または通知に関連づけたい任意のタイムスタンプを表します。例えば、予定されている会議のタイムスタンプは未来に設定することができ、一方、見逃したメッセージのタイムスタンプは過去に設定することができます。
構文
var timestamp = Notification.timestamp;
値
DOMTimeStamp
です。
例
次のスニペットは通知を発行します。単純な options
オブジェクトが生成され、通知が Notification()
コンストラクターを使用して発行されます。
var dts = Math.floor(Date.now());
var options = {
body: 'Do you like my body?',
timestamp: dts
}
var n = new Notification('Test notification',options);
console.log(n.timestamp) // should log original timestamp
仕様書
仕様書 | 状態 | 備考 |
---|---|---|
Notifications API timestamp の定義 |
現行の標準 | Living standard |
ブラウザーの互換性
BCD tables only load in the browser