aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/api/idbobjectstore/getkey
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/fr/web/api/idbobjectstore/getkey
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/fr/web/api/idbobjectstore/getkey')
-rw-r--r--files/fr/web/api/idbobjectstore/getkey/index.html174
1 files changed, 174 insertions, 0 deletions
diff --git a/files/fr/web/api/idbobjectstore/getkey/index.html b/files/fr/web/api/idbobjectstore/getkey/index.html
new file mode 100644
index 0000000000..9e56d3b408
--- /dev/null
+++ b/files/fr/web/api/idbobjectstore/getkey/index.html
@@ -0,0 +1,174 @@
+---
+title: IDBObjectStore.getKey()
+slug: Web/API/IDBObjectStore/getKey
+translation_of: Web/API/IDBObjectStore/getKey
+---
+<p>{{ APIRef("IndexedDB") }}</p>
+
+<div>
+<p>La méthode <strong><code>getKey()</code></strong> de l'interface {{domxref("IDBObjectStore")}} retourne un objet {{domxref("IDBRequest")}}, et, dans un <em>thread</em> séparé, retourne la clé sélectionnée par la requête spécifiée. Cela permet de retrouver un enregistrement spécifique depuis un espace de stockage déterminé.</p>
+</div>
+
+<p>Si la clé a bien été retrouvée, alors un clone structuré (une copie conforme) sera créée et servira comme résultat à l'objet de requête.</p>
+
+<p>{{AvailableInWorkers}}</p>
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="syntaxbox">var request = <em>objectStore</em>.getKey(<em>key</em>);</pre>
+
+<h3 id="Parameters">Parameters</h3>
+
+<dl>
+ <dt><em>key</em></dt>
+ <dd>La clé ou l'intervale de clé qui identifie l'enregistrement à retrouver.</dd>
+</dl>
+
+<h3 id="Return_Value">Return Value</h3>
+
+<p>An {{domxref("IDBRequest")}} object on which subsequent events related to this operation are fired.</p>
+
+<h3 id="Exceptions">Exceptions</h3>
+
+<p>This method may raise a {{domxref("DOMException")}} of one of the following types:</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>This {{domxref("IDBObjectStore")}}'s transaction is inactive.</td>
+ </tr>
+ <tr>
+ <td><code>DataError</code></td>
+ <td>
+ <p>The key or key range provided contains an invalid key.</p>
+ </td>
+ </tr>
+ <tr>
+ <td><code>InvalidStateError</code></td>
+ <td>The {{domxref("IDBObjectStore")}} has been deleted or removed.<br>
+  </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Example">Example</h2>
+
+<pre class="brush: js">let openRequest = indexedDB.open("telemetry");
+openRequest.onsuccess = (event) =&gt; {
+ let db = event.target.result;
+ let store = db.transaction("netlogs").objectStore("netlogs");
+
+ let today = new Date();
+ let yesterday = new Date(today);
+ yesterday.setDate(today.getDate() - 1);
+ let request = store.getKey(IDBKeyRange(yesterday, today));
+ request.onsuccess = (event) =&gt; {
+ let when = event.target.result;
+ alert("The 1st activity in last 24 hours was occurred at " + when);
+ };
+};</pre>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('IndexedDB 2', '#dom-idbobjectstore-getkey', 'getKey()')}}</td>
+ <td>{{Spec2('IndexedDB 2')}}</td>
+ <td>Initial definition</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari (WebKit)</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatChrome(58)}}</td>
+ <td>{{CompatGeckoDesktop("51.0")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatOpera(45)}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ <tr>
+ <td>Available in workers</td>
+ <td>{{CompatChrome(58)}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatOpera(45)}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android Webview</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Phone</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatChrome(58)}}</td>
+ <td>{{CompatChrome(58)}}</td>
+ <td>{{CompatGeckoMobile("51.0")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatOperaMobile(45)}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ <tr>
+ <td>Available in workers</td>
+ <td>{{CompatChrome(58)}}</td>
+ <td>{{CompatChrome(58)}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatOperaMobile(45)}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB">Using IndexedDB</a></li>
+ <li>Starting transactions: {{domxref("IDBDatabase")}}</li>
+ <li>Using transactions: {{domxref("IDBTransaction")}}</li>
+ <li>Setting a range of keys: {{domxref("IDBKeyRange")}}</li>
+ <li>Retrieving and making changes to your data: {{domxref("IDBObjectStore")}}</li>
+ <li>Using cursors: {{domxref("IDBCursor")}}</li>
+ <li>Reference example: <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/">view example live</a>.)</li>
+</ul>