notifications

Afficher les notifications à l'utilisateur, en utilisant le mécanisme de notification du système d'exploitation sous-jacent. Étant donné que cette API utilise le mécanisme de notification du système d'exploitation, les détails de l'apparence et du comportement des notifications peuvent varier en fonction du système d'exploitation et des paramètres de l'utilisateur.

Pour utiliser cette API, vous devez avoir la permission "notifications".

La notification est identique sur tous les systèmes d'exploitation de bureau. Quelque chose comme :

Types

notifications.NotificationOptions

Définit le contenu d'une notification.

notifications.TemplateType

Le type de notification Par exemple, cela définit si la notification peut contenir une image.

Fonctions

notifications.clear()

Effacer une notification spécifique, compte tenu de son identifiant.

notifications.create()

Créez et affichez une nouvelle notification.

notifications.getAll()

Recevez toutes les notifications

notifications.update()

Mettre à jour une notification

Evénements

notifications.onButtonClicked

Lancé lorsque l'utilisateur a cliqué sur un bouton dans la notification.

notifications.onClicked

Lancé lorsque l'utilisateur a cliqué sur la notification, mais pas sur un bouton.

notifications.onClosed

Lancé lorsqu'une notification est fermée, soit par le système, soit parce que l'utilisateur l'a rejeté..

notifications.onShown

Lancé immédiatement après l'affichage d'une notification.

Compatibilité des navigateurs

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
notifications
NotificationOptions
NotificationOptions.appIconMaskUrl
NotificationOptions.buttons
NotificationOptions.contextMessage
NotificationOptions.eventTime
NotificationOptions.imageUrl
NotificationOptions.isClickable
NotificationOptions.items
NotificationOptions.priority
NotificationOptions.progress
NotificationOptions.requireInteraction
TemplateType
clear
create
getAll
onButtonClicked
onClicked
onClosed
onClosed.byUser
onShown
update

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
See implementation notes.

Example extensions