OS の通知メカニズムを使って、ユーザーへの通知を表示します。この API は OS の通知メカニズムを使うため、OS とユーザー設定によって通知の現れ方やふるまいは変わってきます。
この API を使うには "notifications" パーミッションが必要です。
すべてのデスクトップOSで通知は同じ見た目です。次のようなものです:
型
notifications.NotificationOptions
- 通知の中身を定義します。
notifications.TemplateType
- 通知の種類。例えば、通知に画像を含められるかなどを定義します。
関数
notifications.clear()
- IDに基づいた特定の通知をクリアします。
notifications.create()
- 新規の通知を作成、表示します。
notifications.getAll()
- すべての通知を取得します。
notifications.update()
- 通知を更新します。
イベント
notifications.onButtonClicked
- ユーザーが通知内のボタンをクリックしたときに発火します。
notifications.onClicked
- ユーザーが通知内のボタン以外をクリックしたときに発火します。
notifications.onClosed
- 通知が閉じたとき、システムかユーザーいずれかがやめた場合にも、発火します。
notifications.onShown
- 通知が表示されるとすぐに発火します。
ブラウザー実装状況
BCD tables only load in the browser
Example extensions
Acknowledgements
This API is based on Chromium's chrome.notifications
API.