diff options
Diffstat (limited to 'files/fr/mozilla/add-ons/webextensions/api/commands/getall/index.html')
| -rw-r--r-- | files/fr/mozilla/add-ons/webextensions/api/commands/getall/index.html | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/files/fr/mozilla/add-ons/webextensions/api/commands/getall/index.html b/files/fr/mozilla/add-ons/webextensions/api/commands/getall/index.html new file mode 100644 index 0000000000..76c2f8a5e6 --- /dev/null +++ b/files/fr/mozilla/add-ons/webextensions/api/commands/getall/index.html @@ -0,0 +1,61 @@ +--- +title: getAll() +slug: Mozilla/Add-ons/WebExtensions/API/commands/getAll +tags: + - API + - Add-ons + - Extensions + - Method + - Non-standard + - Reference + - WebExtensions + - commands + - getAll +translation_of: Mozilla/Add-ons/WebExtensions/API/commands/getAll +--- +<div>{{AddonSidebar()}}</div> + +<p>Obient toutes les commandes pour l'exécution que vous avez enregistré à l'aide d'une des <a href="/fr/Add-ons/WebExtensions/manifest.json/commands"><code>commandes</code> clef du manifest.json</a>.</p> + +<p>Les commandes sont renvoyées sous la forme d'un tableau d'objets {{WebExtAPIRef('commands.Command')}}. Altenativement, si vous utilisez la version de base promise de l'API, <code>browser.commands.getAll()</code>, les commandes sont passées dans l'argument <code>onFulfilled</code> à <code><a href="/fr/docs/Web/JavaScript/Reference/Objets_globaux/Promise/then">Promise.then()</a></code>.</p> + +<p>C'est une fonction asynchrone qui renvoie une <code><a href="/fr/docs/Web/JavaScript/Reference/Objets_globaux/Promise">Promise</a></code>.</p> + +<h2 id="Syntaxe">Syntaxe</h2> + +<pre class="syntaxbox brush:js">var getCommands = browser.commands.getAll(); +</pre> + +<h3 id="Paramètres">Paramètres</h3> + +<p>Aucun.</p> + +<h3 id="Valeur_retournée">Valeur retournée</h3> + +<p>Une <code><a href="/fr/docs/Web/JavaScript/Reference/Objets_globaux/Promise">Promise</a></code> qui sera accompli avec un tableau d'objets <code>{{WebExtAPIRef('commands.Command')}}</code>, un pour chaque commande enregistrée pour l'extension. Si aucune n'a été enregistrée, le tableau sera vide.</p> + +<h2 id="Compatibilité_du_navigateur">Compatibilité du navigateur</h2> + +<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> + +<p>{{Compat("webextensions.api.commands.getAll")}}</p> + +<h2 id="Exemples">Exemples</h2> + +<pre class="brush: js">function logCommands(commands) { + commands.forEach(function(command) { + console.log(command); + }); +} + +var getCommands = browser.commands.getAll(); +getCommands.then(logCommands);</pre> + +<p>{{WebExtExamples}}</p> + +<div class="note"><strong>Remerciements :</strong> + +<p>Cette API est basée sur l'API Chromium <a href="https://developer.chrome.com/extensions/commands"><code>chrome.commands</code></a>.</p> + +<p>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.</p> +</div> |
