Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 1050448 of IDBEnvironment

  • Raccourci de la révision : Web/API/IDBEnvironment
  • Titre de la révision : IDBEnvironment
  • ID de la révision : 1050448
  • Créé :
  • Créateur : gadgino
  • Version actuelle ? Non
  • Commentaire première traduction
Étiquettes : 

Contenu de la révision

{{APIRef("IndexedDB")}}

L'interface IDBEnvironment de l'API IndexedDB contient la propriètè indexedDB , donnant accès aux fonctionnalités de l'interface IndexedDB. C'est le plus haut degré de l'interface IndexedDB implémenté par les objets {{domxref("window")}} et {{domxref("Worker")}}.

{{AvailableInWorkers}}

Propriétés

{{domxref("IDBEnvironment.indexedDB")}} {{readonlyInline}}
Contient un objet {{domxref("IDBFactory")}} qui permet aux applications d'accéder asychroniquement aux capacités des bases de données indexées.

Exemple

Le code fait une demande asynchrone d'ouverture d'une base de données. Puis la base de données est ouverte quand l'événement onsuccess de la demande est déclenché.

var db;
function openDB() {
 var DBOpenRequest = window.indexedDB.open("toDoList");
 DBOpenRequest.onsuccess = function(e) {
   db = DBOpenRequest.result;
 };
}

Spécifications

Spécification Statut Commentaire
{{SpecName('IndexedDB', '#idl-def-IDBEnvironment', 'IDBEnvironment')}} {{Spec2('IndexedDB')}}

Compatibilité avec les navigateurs

{{CompatibilityTable}}
Fonctionnalité Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Support basique 23{{property_prefix("webkit")}}
24
10 {{property_prefix("moz")}}
{{CompatGeckoDesktop("16.0")}}
10, en partie 15 7.1
Disponible dans workers {{CompatVersionUnknown}} {{CompatGeckoMobile("37.0")}} {{CompatUnknown}} {{CompatVersionUnknown}} {{CompatUnknown}}
Fonctionnalité Android Firefox Mobile (Gecko) Firefox OS IE Phone Opera Mobile Safari Mobile
Support basique 4.4 {{CompatGeckoMobile("22.0")}} 1.0.1 10 22 8
Disponible dans workers {{CompatVersionUnknown}} {{CompatGeckoMobile("37.0")}} {{CompatVersionUnknown}} {{CompatUnknown}} {{CompatVersionUnknown}} {{CompatUnknown}}

Soyez prudent avec Chrome car il implémente l'ancienne et la nouvelle spécification. De même, la syntaxe préfixée webkitIndexedDB et non préfixée IndexedDB sont présente.

Voir aussi

  • Using IndexedDB
  • Starting transactions: {{domxref("IDBDatabase")}}
  • Using transactions: {{domxref("IDBTransaction")}}
  • Setting a range of keys: {{domxref("IDBKeyRange")}}
  • Retrieving and making changes to your data: {{domxref("IDBObjectStore")}}
  • Using cursors: {{domxref("IDBCursor")}}
  • Reference example: To-do Notifications (view example live.)

Source de la révision

<p>{{APIRef("IndexedDB")}}</p>

<p>L'interface <strong><code>IDBEnvironment</code></strong> de l'<a href="/en-US/docs/IndexedDB">API IndexedDB</a> contient la propriètè <code>indexedDB</code> , donnant accès aux fonctionnalités de l'interface IndexedDB. C'est le plus haut degré de l'interface IndexedDB implémenté par les objets {{domxref("window")}} et {{domxref("Worker")}}.</p>

<p>{{AvailableInWorkers}}</p>

<h2 id="Properties">Propriétés</h2>

<dl>
 <dt>{{domxref("IDBEnvironment.indexedDB")}} {{readonlyInline}}</dt>
 <dd>Contient un objet {{domxref("IDBFactory")}} qui permet aux applications d'accéder asychroniquement aux capacités des bases de données indexées.</dd>
</dl>

<h2 id="Example">Exemple</h2>

<p> Le code fait une demande  asynchrone d'ouverture d'une base de données. Puis la base de données est ouverte quand l'événement <code>onsuccess</code> de la demande est déclenché.</p>  
	

<pre class="brush: js;highlight:[3]">var db;
function openDB() {
 var DBOpenRequest = window.indexedDB.open("toDoList");
 DBOpenRequest.onsuccess = function(e) {
   db = DBOpenRequest.result;
 };
}
</pre>

<h2 id="Specifications">Spécifications</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Spécification</th>
   <th scope="col">Statut</th>
   <th scope="col">Commentaire</th>
  </tr>
  <tr>
   <td>{{SpecName('IndexedDB', '#idl-def-IDBEnvironment', 'IDBEnvironment')}}</td>
   <td>{{Spec2('IndexedDB')}}</td>
   <td> </td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility" name="Browser_compatibility">Compatibilité avec les 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 basique</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 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 basique</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 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>

<div class="warning">
<p>Soyez prudent avec Chrome car il implémente l'ancienne et la nouvelle spécification. De même, la syntaxe préfixée <code>webkitIndexedDB</code> et non préfixée <code>IndexedDB</code> sont présente.</p>
</div>

<h2 id="See_also">Voir aussi</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>
Revenir à cette révision