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

Cette méthode permet d'obtenir une alarme en fonction de son nom. Cette fonction est une fonction asynchrone qui renvoie une promesse ({{jsxref("Promise")}}).

+ +

Syntaxe

+ +
var getAlarm = browser.alarms.get(
+  name  // optional string
+)
+
+ +

Paramètres

+ +
+
name{{optional_inline}}
+
string. Le nom de l'alarme qu'on souhaite récupérer. La valeur par défaut, utilisée si aucun argument n'est fournie, sera la chaîne vide ("").
+
+ +

Valeur de retour

+ +

Une promesse ({{jsxref("Promise")}}) qui sera tenue avec un objet {{WebExtAPIRef('alarms.Alarm', "Alarm")}}. Cette valeur correspond à l'alarme dont le nom correspond au paramètre name. Si aucune alarme ne correspond, la valeur renvoyée sera undefined.

+ +

Exemples

+ +
function gotAlarm(alarm) {
+  if (alarm) {
+    console.log(alarm.name);
+  }
+}
+
+var getAlarm = browser.alarms.get("my-periodic-alarm");
+getAlarm.then(gotAlarm);
+ +

{{WebExtExamples}}

+ +

Compatibilité du navigateur

+ + + +

{{Compat("webextensions.api.alarms.get")}}

+ +
Remerciements : + +

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

+ +

Les données de compatibilité relatives à Microsoft Edge sont fournies par Microsoft Corporation et incluses ici sous la licence Creative Commons Attribution 3.0 pour les États-Unis.

+
-- cgit v1.2.3-54-g00ecf