From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../api/notifications/onshown/index.html | 77 ++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 files/fr/mozilla/add-ons/webextensions/api/notifications/onshown/index.html (limited to 'files/fr/mozilla/add-ons/webextensions/api/notifications/onshown/index.html') diff --git a/files/fr/mozilla/add-ons/webextensions/api/notifications/onshown/index.html b/files/fr/mozilla/add-ons/webextensions/api/notifications/onshown/index.html new file mode 100644 index 0000000000..06f31fdd88 --- /dev/null +++ b/files/fr/mozilla/add-ons/webextensions/api/notifications/onshown/index.html @@ -0,0 +1,77 @@ +--- +title: notifications.onShown +slug: Mozilla/Add-ons/WebExtensions/API/notifications/onShown +tags: + - API + - Add-ons + - Event + - Extensions + - Reference + - WebExtensions + - events + - onShown +translation_of: Mozilla/Add-ons/WebExtensions/API/notifications/onShown +--- +
{{AddonSidebar()}}
+ +

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

+ +

Syntaxe

+ +
browser.notifications.onShown.addListener(listener)
+browser.notifications.onShown.removeListener(listener)
+browser.notifications.onShown.hasListener(listener)
+
+ +

Les événements ont trois fonctions :

+ +
+
addListener(callback)
+
Ajoute un écouteur à cet événement.
+
removeListener(listener)
+
Arrêtez d'écouter cet événement. L'argument listener est l'écouteur à supprimer.
+
hasListener(listener)
+
Vérifiez si listener est enregistré pour cet événement. Renvoie trues'il écoute, sinon false.
+
+ +

syntaxe addListener

+ +

Paramètres

+ +
+
callback
+
+

Fonction qui sera appelée lorsque cet événement se produit. La fonction recevra les arguments suivants :

+ +
+
notificationId
+
string. ID de la notification qui a été affichée.
+
+
+
+ +

Compatibilité du navigateur

+ + + +

{{Compat("webextensions.api.notifications.onShown")}}

+ +

Exemples

+ +

Ajoutez un écouteur à l'événement {{WebExtAPIRef("notifications.onShown")}} et consignez ses détails :

+ +
function logShown(itemId) {
+  console.log(`shown: ${itemId}`);
+  browser.notifications.getAll().then((all) => {
+    console.log(all[itemId]);
+  })
+}
+
+browser.notifications.onShown.addListener(logShown);
+ +

{{WebExtExamples}}

+ +
Remerciements : + +

Cette API est basée sur l'API Chromium chrome.notifications.

+
-- cgit v1.2.3-54-g00ecf