--- title: IDBKeyRange.lowerOpen slug: Web/API/IDBKeyRange/lowerOpen tags: - API - IDBKeyRange - IndexedDB - Propriété - Reference translation_of: Web/API/IDBKeyRange/lowerOpen ---
La propriété lowerOpen
, rattachée à l'interface {{domxref("IDBKeyRange")}}, renvoie un booléen qui inidque si l'intervalle est ouvert pour la borne inférieure (autrement dit, le booléen est vrai lorsque la borne n'est pas incluse et est faux sinon).
{{AvailableInWorkers}}
myKeyRange.lowerOpen;
Un booléen qui indique si l'intervalle est ouvert pour la borne inférieure (true
si c'est le cas (la borne n'est pas incluse), false
sinon).
Dans l'exemple qui suit, on voit comment utiliser un intervalle de clé. On déclare keyRangeValue = IDBKeyRange.upperBound("F", "W", true, true);
— c'est-à-dire un intervalle qui inclue tout ce qui se trouve entre "F" et "W" mais qui n'inclue pas ces bornes (l'intervalle est « ouvert »). Ensuite, on ouvre une transaction grâce à {{domxref("IDBTransaction")}} puis on ouvre un magasin d'objet et un curseur grâce à {{domxref("IDBObjectStore.openCursor")}}. La valeur keyRangeValue
est utilisée comme intervalle de clé pour ce curseur.
Après avoir déclaré l'intervalle de clé, on affiche la valeur de la propriété lowerOpen
dans la console. Ici, la valeur de la propriété est true
car l'intervalle est ouvert pour la borne supérieure et la borne inférieure qui ne sont donc pas comprises dans l'intervalle.
function displayData() { var keyRangeValue = IDBKeyRange.bound("F", "W", true, true); console.log(keyRangeValue.lowerOpen); 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écification | État | Commentaires |
---|---|---|
{{SpecName('IndexedDB', '#widl-IDBKeyRange-lowerOpen', 'lowerOpen')}} | {{Spec2('IndexedDB')}} |
Fonctionnalité | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|---|
Support simple | 23{{property_prefix("webkit")}} 24 (unprefixed) |
{{CompatVersionUnknown}} | 10 {{property_prefix("moz")}} {{CompatGeckoDesktop("16.0")}} |
10, partial | 15 | 7.1 |
Disponible dans les web workers | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatGeckoMobile("37.0")}} | {{CompatUnknown}} | {{CompatVersionUnknown}} | {{CompatUnknown}} |
Fonctionnalité | Android | Webview Android | Edge | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile | Chrome pour Android |
---|---|---|---|---|---|---|---|---|
Support simple | 4.4 | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatGeckoMobile("22.0")}} | 10 | 22 | 8 | {{CompatVersionUnknown}} |
Disponible dans les web workers | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatGeckoMobile("37.0")}} | {{CompatUnknown}} | {{CompatVersionUnknown}} | {{CompatUnknown}} | {{CompatVersionUnknown}} |