aboutsummaryrefslogtreecommitdiff
path: root/files/fr/mozilla/add-ons/webextensions/api/tabs/onmoved/index.md
diff options
context:
space:
mode:
Diffstat (limited to 'files/fr/mozilla/add-ons/webextensions/api/tabs/onmoved/index.md')
-rw-r--r--files/fr/mozilla/add-ons/webextensions/api/tabs/onmoved/index.md131
1 files changed, 131 insertions, 0 deletions
diff --git a/files/fr/mozilla/add-ons/webextensions/api/tabs/onmoved/index.md b/files/fr/mozilla/add-ons/webextensions/api/tabs/onmoved/index.md
new file mode 100644
index 0000000000..a9ab08a87f
--- /dev/null
+++ b/files/fr/mozilla/add-ons/webextensions/api/tabs/onmoved/index.md
@@ -0,0 +1,131 @@
+---
+title: tabs.onMoved
+slug: Mozilla/Add-ons/WebExtensions/API/tabs/onMoved
+tags:
+ - API
+ - Add-ons
+ - Event
+ - Extensions
+ - Non-standard
+ - Reference
+ - WebExtensions
+ - onMoved
+ - tabs
+translation_of: Mozilla/Add-ons/WebExtensions/API/tabs/onMoved
+---
+<div>{{AddonSidebar()}}</div>
+
+<p>Lancé lorsqu'un onglet est déplacé dans une fenêtre</p>
+
+<p>Un seul événement de déplacement est déclenché, représentant l'onglet que l'utilisateur a déplacé directement. Les événements de déplacement ne sont pas déclenchés pour les autres onglets qui doivent se déplacer en réponse. Cet événement n'est pas déclenché lorsqu'un onglet est déplacé entre des fenêtres. Pour cela, voir  {{WebExtAPIRef('tabs.onDetached')}}.</p>
+
+<h2 id="Syntaxe">Syntaxe</h2>
+
+<pre class="brush: js">browser.tabs.onMoved.addListener(listener)
+browser.tabs.onMoved.removeListener(listener)
+browser.tabs.onMoved.hasListener(listener)
+</pre>
+
+<p>Les événements ont trois fonctions:</p>
+
+<dl>
+ <dt><code>addListener(callback)</code></dt>
+ <dd>Ajoute un écouteur à cet événement.</dd>
+ <dt><code>removeListener(listener)</code></dt>
+ <dd>Arrêtez d'écouter cet événement. L'argument <code>listener</code> st l'écouteur à supprimer.</dd>
+ <dt><code>hasListener(listener)</code></dt>
+ <dd>Vérifiez si le <code>listener</code>est enregistré pour cet événement. Renvoie <code>true</code> s'il écoute, sinon <code>false</code>.</dd>
+</dl>
+
+<h2 id="Syntaxe_addListener">Syntaxe addListener</h2>
+
+<h3 id="Paramètres">Paramètres</h3>
+
+<dl>
+ <dt><code>callback</code></dt>
+ <dd>
+ <p>Fonction qui sera appelée lorsque cet événement se produit. La fonction recevra les arguments suivants :</p>
+
+ <dl>
+ <dt><code>tabId</code></dt>
+ <dd><code>integer</code>. ID de l'onglet déplacé par l'utilisateur.</dd>
+ </dl>
+
+ <dl>
+ <dt><code>moveInfo</code></dt>
+ <dd><a href="#moveInfo"><code>object</code></a>. Informations sur le déménagement.</dd>
+ </dl>
+ </dd>
+</dl>
+
+<h2 id="Objets_supplémentaires">Objets supplémentaires</h2>
+
+<h3 id="moveInfo">moveInfo</h3>
+
+<dl>
+ <dt><code>windowId</code></dt>
+ <dd><code>integer</code>. ID de la fenêtre de cet onglet.</dd>
+ <dt><code>fromIndex</code></dt>
+ <dd><code>integer</code>. Index initial de cet onglet dans la fenêtre.</dd>
+ <dt><code>toIndex</code></dt>
+ <dd><code>integer</code>. Index final de cet onglet dans la fenêtre</dd>
+</dl>
+
+<h2 id="Exemples">Exemples</h2>
+
+<p>Écouter et enregistrer les événements de déplacement :</p>
+
+<pre class="brush: js">function handleMoved(tabId, moveInfo) {
+ console.log("Tab " + tabId +
+ " moved from " + moveInfo.fromIndex +
+ " to " + moveInfo.toIndex);
+}
+
+browser.tabs.onMoved.addListener(handleMoved);</pre>
+
+<p>{{WebExtExamples}}</p>
+
+<dl>
+</dl>
+
+<h2 id="Compatibilité_du_navigateur">Compatibilité du navigateur</h2>
+
+<p>{{Compat("webextensions.api.tabs.onMoved")}}</p>
+
+<div class="note"><p><strong>Note :</strong></p>
+
+<p>Cette API est basée sur l'API Chromium <a href="https://developer.chrome.com/extensions/tabs#method-executeScript"><code>chrome.tabs</code></a>. Cette documentation est dérivée de <a href="https://chromium.googlesource.com/chromium/src/+/master/chrome/common/extensions/api/tabs.json"><code>tabs.json</code></a> dans le code de Chromium code.</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>
+
+<div class="hidden">
+<pre>// Copyright 2015 The Chromium Authors. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+</pre>
+</div>