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/idbkeyrange/lower | |
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/idbkeyrange/lower')
-rw-r--r-- | files/fr/web/api/idbkeyrange/lower/index.html | 164 |
1 files changed, 164 insertions, 0 deletions
diff --git a/files/fr/web/api/idbkeyrange/lower/index.html b/files/fr/web/api/idbkeyrange/lower/index.html new file mode 100644 index 0000000000..a3a607bf0b --- /dev/null +++ b/files/fr/web/api/idbkeyrange/lower/index.html @@ -0,0 +1,164 @@ +--- +title: IDBKeyRange.lower +slug: Web/API/IDBKeyRange/lower +tags: + - API + - IDBKeyRange + - IndexedDB + - Propriété + - Reference +translation_of: Web/API/IDBKeyRange/lower +--- +<div>{{APIRef("IndexedDB")}}</div> + +<p>La propriété <strong><code>lower</code></strong>, rattachée à l'interface {{domxref("IDBKeyRange")}}, renvoie la borne inférieure de l'intervalle de clé.</p> + +<p>{{AvailableInWorkers}}</p> + +<h2 id="Syntaxe">Syntaxe</h2> + +<pre class="brush: js">monIntervalle.lower;</pre> + +<h3 id="Valeur">Valeur</h3> + +<p>La borne inférieure de l'intervalle de clé (qui peut être d'un type quelconque).</p> + +<h2 id="Exemples">Exemples</h2> + +<p>Dans l'exemple qui suit, on voit comment utiliser un intervalle de clé. On déclare <code>keyRangeValue = IDBKeyRange.upperBound("F", "W", true, true);</code> — ce qui correspond à intervalle qui inclut tout ce qui se trouve entre "F" et "W" mais pas ces valeurs (l'intervalle est « ouvert »). Ensuite, on ouvre une transaction grâce à {{domxref("IDBTransaction")}}, un magasin d'objet et un curseur grâce à {{domxref("IDBObjectStore.openCursor")}} pour lequel on déclare que <code>keyRangeValue</code> est l'intervalle de clé optionnel.</p> + +<p>Après avoir déclaré l'intervalle de clé, on affiche la valeur de la propriété <code>lower</code> dans la console (ce qui doit donner "F").</p> + +<pre class="brush: js">function displayData() { + var keyRangeValue = IDBKeyRange.bound("F", "W", true, true); + console.log(keyRangeValue.lower); + + var transaction = db.transaction(['fThings'], 'readonly'); + var objectStore = transaction.objectStore('fThings'); + + objectStore.openCursor(keyRangeValue).onsuccess = function(event) { + var cursor = event.target.result; + if(cursor) { + var listItem = document.createElement('li'); + listItem.innerHTML = '<strong>' + cursor.value.fThing + '</strong>, ' + cursor.value.fRating; + list.appendChild(listItem); + + cursor.continue(); + } else { + console.log('Les éléments ont été affichés.'); + } + }; + };</pre> + +<div class="note"> +<p><strong>Note </strong>: Pour un exemple complet qui utilise les intervalles de clé, vous pouvez consulter <a href="https://github.com/mdn/IDBKeyRange-example">le dépôt GitHub IDBKeyRange-example</a> (<a href="https://mdn.github.io/IDBKeyRange-example/">ainsi que la démonstration associée</a>).</p> +</div> + +<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-IDBKeyRange-lower', 'lower')}}</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>Edge</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 (unprefixed)</td> + <td>{{CompatVersionUnknown}}</td> + <td>10 {{property_prefix("moz")}}<br> + {{CompatGeckoDesktop("16.0")}}</td> + <td>10, partial</td> + <td>15</td> + <td>7.1</td> + </tr> + <tr> + <td>Disponible dans les <em>web workers</em></td> + <td>{{CompatVersionUnknown}}</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>Webview Android</th> + <th>Edge</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Phone</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + <th>Chrome pour Android</th> + </tr> + <tr> + <td>Support simple</td> + <td>4.4</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoMobile("22.0")}}</td> + <td>10</td> + <td>22</td> + <td>8</td> + <td>{{CompatVersionUnknown}}</td> + </tr> + <tr> + <td>Disponible dans les <em>web workers</em></td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoMobile("37.0")}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<h2 id="Voir_aussi">Voir aussi</h2> + +<ul> + <li><a href="/fr/docs/Web/API/API_IndexedDB/Using_IndexedDB">Utiliser IndexedDB</a></li> + <li>Initier une connexion : {{domxref("IDBDatabase")}}</li> + <li>Utiliser les transactions : {{domxref("IDBTransaction")}}</li> + <li>Définir un intervalle de clés : {{domxref("IDBKeyRange")}}</li> + <li>Récupérer et modifier les données : {{domxref("IDBObjectStore")}}</li> + <li>Utiliser les curseurs {{domxref("IDBCursor")}}</li> + <li>Exemple de référence : <a class="external" href="https://github.com/mdn/to-do-notifications/tree/gh-pages">To-do Notifications</a> (<a class="external" href="https://mdn.github.io/to-do-notifications/">exemple <em>live</em></a>).</li> +</ul> |