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/web/api/idbcursor/continue | |
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/web/api/idbcursor/continue')
-rw-r--r-- | files/fr/web/api/idbcursor/continue/index.html | 184 |
1 files changed, 184 insertions, 0 deletions
diff --git a/files/fr/web/api/idbcursor/continue/index.html b/files/fr/web/api/idbcursor/continue/index.html new file mode 100644 index 0000000000..f93060fbd2 --- /dev/null +++ b/files/fr/web/api/idbcursor/continue/index.html @@ -0,0 +1,184 @@ +--- +title: IDBCursor.continue() +slug: Web/API/IDBCursor/continue +tags: + - API + - IndexedDB + - Méthode + - Reference +translation_of: Web/API/IDBCursor/continue +--- +<div>{{APIRef("IndexedDB")}}</div> + +<p>La méthode <strong><code>continue()</code></strong> de l'interface {{domxref("IDBCursor")}} fait avancer le curseur jusqu'à la prochaine position qui corrrespond à une clé donnée si celle-ci est passée en paramètre, si aucune clé n'est indiquée, le curseur avancera à la position qui suit immédiatement la position actuelle (dans la direction de progression du curseur).</p> + +<p>{{AvailableInWorkers}}</p> + +<h2 id="Syntaxe">Syntaxe</h2> + +<pre class="brush: js">curseur.continue(<em>cléOptionnelle</em>);</pre> + +<h3 id="Paramètres">Paramètres</h3> + +<dl> + <dt><code><em>cléOptionnelle</em></code></dt> + <dd>La clé sur laquelle se positionne le curseur.</dd> +</dl> + +<h3 id="Exceptions">Exceptions</h3> + +<p>Cette méthode peut déclencher des exceptions {{domxref("DOMException")}} de type :</p> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Exception</th> + <th scope="col">Description</th> + </tr> + </thead> + <tbody> + <tr> + <td><code>TransactionInactiveError</code></td> + <td>La transaction de l'IDBCursor est inactive.</td> + </tr> + <tr> + <td><code>DataError</code></td> + <td> + <p>Le paramètre <code><em>cléOptionnelle</em></code> peut:</p> + + <ul> + <li>Être invalide.</li> + <li>Être inférieur ou égal à la position de ce curseur et la direction du curseur <code>next</code> ou <code>nextunique</code>.</li> + <li>Être supérieur ou égal à la position de ce curseur et la direction de ce curseur <code>prev</code> ou <code>prevunique</code>.</li> + </ul> + </td> + </tr> + <tr> + <td><code>InvalidStateError</code></td> + <td>Le curseur est en itération ou il a itéré au-delà de la plage.</td> + </tr> + </tbody> +</table> + +<h2 id="Exemple">Exemple</h2> + +<p>Dans ce petit morceau de code, on fait une transaction, on récupère un magasin d'objet, puis on utilise un curseur afin d'itérer sur les enregistrements contenus dans le magasin. Il n'est pas nécessaire de sélectionner les données selon une clé, on peut simplement toutes les récupérer. On notera qu'à chaque itération de la boucle, on récupère les données correspondantes à l'enregistrement grâce au curseur sous la forme <code>curseur.value.toto</code>. Pour étudier un exemple de travail complet, voir <a href="https://github.com/mdn/IDBcursor-example/">notre exemple IDBCursor</a> (<a href="https://mdn.github.io/IDBcursor-example/">voir l'exemple live</a>).</p> + +<pre class="brush: js">function afficheDonnee() { + var transaction = db.transaction(['granListAlbum'], "readonly"); + var objectStore = transaction.objectStore('granListAlbum'); + + objectStore.openCursor().onsuccess = function(event) { + var curseur = event.target.result; + if(curseur) { + var listItem = document.createElement('li'); + listItem.innerHTML = curseur.value.titreAlbum + ', ' + curseur.value.annee; + list.appendChild(listItem); + + curseur.continue(); + } else { + console.log('Entrées toutes affichés.'); + } + }; +}; +</pre> + +<h2 id="Spécifications">Spécifications</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Spécification</th> + <th scope="col">État</th> + <th scope="col">Commentaires</th> + </tr> + <tr> + <td>{{SpecName('IndexedDB', '#widl-IDBCursor-continue-void-any-key', 'continue()')}}</td> + <td>{{Spec2('IndexedDB')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2> + +<div>{{CompatibilityTable}}</div> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Fonctionnalité</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari (WebKit)</th> + </tr> + <tr> + <td>Support simple</td> + <td>23{{property_prefix("webkit")}}<br> + 24</td> + <td>10 {{property_prefix("moz")}}<br> + {{CompatGeckoDesktop("16.0")}}</td> + <td>10, en partie</td> + <td>15</td> + <td>7.1</td> + </tr> + <tr> + <td>Disponible dans les web workers</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoMobile("37.0")}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Fonctionnalité</th> + <th>Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>Firefox OS</th> + <th>IE Phone</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Support simple</td> + <td>4.4</td> + <td>{{CompatGeckoMobile("22.0")}}</td> + <td>1.0.1</td> + <td>10</td> + <td>22</td> + <td>8</td> + </tr> + <tr> + <td>Disponible dans les web workers</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoMobile("37.0")}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<h2 id="Voir_aussi">Voir aussi</h2> + +<ul> + <li><a href="/fr/docs/Web/API/API_IndexedDB/Using_IndexedDB">Manipuler IndexedDB</a></li> + <li>Démarrer des transactions : {{domxref("IDBDatabase")}}</li> + <li>Manipuler des transactions : {{domxref("IDBTransaction")}}</li> + <li>Définir un intervalle de clés : {{domxref("IDBKeyRange")}}</li> + <li>Récupérer des données et les modifier : {{domxref("IDBObjectStore")}}</li> + <li>Manipuler des curseurs : {{domxref("IDBCursor")}}</li> + <li>Exemple de référence pour IndexedDB : <a href="https://github.com/mdn/to-do-notifications/tree/gh-pages">To-do Notifications</a></li> +</ul> |