diff options
| author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
|---|---|---|
| committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
| commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
| tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/fr/mozilla/add-ons/webextensions/api/commands/update/index.html | |
| parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
| download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip | |
initial commit
Diffstat (limited to 'files/fr/mozilla/add-ons/webextensions/api/commands/update/index.html')
| -rw-r--r-- | files/fr/mozilla/add-ons/webextensions/api/commands/update/index.html | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/files/fr/mozilla/add-ons/webextensions/api/commands/update/index.html b/files/fr/mozilla/add-ons/webextensions/api/commands/update/index.html new file mode 100644 index 0000000000..35365ccb34 --- /dev/null +++ b/files/fr/mozilla/add-ons/webextensions/api/commands/update/index.html @@ -0,0 +1,70 @@ +--- +title: commands.update() +slug: Mozilla/Add-ons/WebExtensions/API/commands/update +tags: + - API + - Add-ons + - Extensions + - Method + - Reference + - Update + - WebExtensions + - commands +translation_of: Mozilla/Add-ons/WebExtensions/API/commands/update +--- +<div>{{AddonSidebar()}}</div> + +<p>Changez la description ou le raccourci clavier pour la commande donnée.</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">browser.commands.update( + details // object +); +</pre> + +<h3 id="Paramètres">Paramètres</h3> + +<dl> + <dt><code>details</code></dt> + <dd><code>object</code>. Un objet avec les propriétés suivantes:</dd> + <dd> + <dl class="reference-values"> + <dt><code>name</code></dt> + <dd><code>string</code>. e nom de la commande à mettre à jour. Cela doit correspondre au nom d'une commande existante, comme indiqué par exemple dans la propriété <code>name</code> de l'objet {{WebExtAPIRef("commands.Command")}}.</dd> + <dt><code>description</code>{{optional_inline}}</dt> + <dd><code>string</code>. Une nouvelle description à définir pour la commande.</dd> + <dt><code>shortcut</code>{{optional_inline}}</dt> + <dd><code>string</code>. Un nouveau raccourci à définir pour la commande. Cela doit correspondre au format donné dans la documentation pour les <a href="/fr/Add-ons/WebExtensions/manifest.json/commands"><code>commands</code> de la clé manifest.json</a>. S'il ne correspond pas à ce format, la fonction va générer une erreur.</dd> + </dl> + </dd> +</dl> + +<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 remplie sans arguments lorsque le raccourci a été réinitialisé. La promesse sera rejetée avec une erreur si la commande n'a pas pu être trouvée.</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.update")}}</p> + +<h2 id="Exemples">Exemples</h2> + +<p>Met à jour la commande "my-command" avec la valeur de raccourci donnée, lorsque l'utilisateur clique sur "update" :</p> + +<pre class="brush: js">const commandName = 'my-command'; + +function updateShortcut() { + browser.commands.update({ + name: commandName, + shortcut: document.querySelector('#shortcut').value + }); +} + +document.querySelector('#update').addEventListener('click', updateShortcut);</pre> + +<p>{{WebExtExamples}}</p> |
