From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/fr/web/api/idbkeyrange/lower/index.html | 164 ++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 files/fr/web/api/idbkeyrange/lower/index.html (limited to 'files/fr/web/api/idbkeyrange/lower') 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 +--- +
{{APIRef("IndexedDB")}}
+ +

La propriété lower, rattachée à l'interface {{domxref("IDBKeyRange")}}, renvoie la borne inférieure de l'intervalle de clé.

+ +

{{AvailableInWorkers}}

+ +

Syntaxe

+ +
monIntervalle.lower;
+ +

Valeur

+ +

La borne inférieure de l'intervalle de clé (qui peut être d'un type quelconque).

+ +

Exemples

+ +

Dans l'exemple qui suit, on voit comment utiliser un intervalle de clé. On déclare keyRangeValue = IDBKeyRange.upperBound("F", "W", true, true); — 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 keyRangeValue est l'intervalle de clé optionnel.

+ +

Après avoir déclaré l'intervalle de clé, on affiche la valeur de la propriété lower dans la console (ce qui doit donner "F").

+ +
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.');
+      }
+    };
+  };
+ +
+

Note : Pour un exemple complet qui utilise les intervalles de clé, vous pouvez consulter le dépôt GitHub IDBKeyRange-example (ainsi que la démonstration associée).

+
+ +

Spécifications

+ + + + + + + + + + + + + + +
SpécificationÉtatCommentaires
{{SpecName('IndexedDB', '#widl-IDBKeyRange-lower', 'lower')}}{{Spec2('IndexedDB')}} 
+ +

Compatibilité des navigateurs

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FonctionnalitéChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Support simple23{{property_prefix("webkit")}}
+ 24 (unprefixed)
{{CompatVersionUnknown}}10 {{property_prefix("moz")}}
+ {{CompatGeckoDesktop("16.0")}}
10, partial157.1
Disponible dans les web workers{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatGeckoMobile("37.0")}}{{CompatUnknown}}{{CompatVersionUnknown}}{{CompatUnknown}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FonctionnalitéAndroidWebview AndroidEdgeFirefox Mobile (Gecko)IE PhoneOpera MobileSafari MobileChrome pour Android
Support simple4.4{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatGeckoMobile("22.0")}}10228{{CompatVersionUnknown}}
Disponible dans les web workers{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatGeckoMobile("37.0")}}{{CompatUnknown}}{{CompatVersionUnknown}}{{CompatUnknown}}{{CompatVersionUnknown}}
+
+ +

Voir aussi

+ + -- cgit v1.2.3-54-g00ecf