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/idbdatabase/close/index.html | 147 ++++++++++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 files/fr/web/api/idbdatabase/close/index.html (limited to 'files/fr/web/api/idbdatabase/close') diff --git a/files/fr/web/api/idbdatabase/close/index.html b/files/fr/web/api/idbdatabase/close/index.html new file mode 100644 index 0000000000..85659d1c4c --- /dev/null +++ b/files/fr/web/api/idbdatabase/close/index.html @@ -0,0 +1,147 @@ +--- +title: IDBDatabase.close() +slug: Web/API/IDBDatabase/close +tags: + - API + - IndexedDB + - Méthode + - Reference +translation_of: Web/API/IDBDatabase/close +--- +
{{APIRef("IndexedDB")}}
+ +

La méthode close() de l'interface {{domxref("IDBDatabase")}} ferme de façon asynchrone la connexion à la base de donnée.

+ +

La connexion sera fermée lorsque toutes les transactions liées à cette connexion seront terminées. En revanche, on ne pourra pas démarrer de nouvelles transactions sur la connexion une fois que cette méthode a été appelée. Les méthodes qui initialisent des transactions déclencheront une exception lorsque la fermeture est en cours.

+ +

{{AvailableInWorkers}}

+ +

Syntaxe

+ +
db.close();
+ +

Valeur de retour

+ +

Aucune.

+ +

Exemple

+ +
// ouverture de la connexion à la base de données toDoList
+  var DBOpenRequest = window.indexedDB.open("toDoList", 4);
+
+  // deux gestionnaires d’événements effectuant les
+  // opérations après que l'ouverture se soit bien
+  // passée ou non.
+  DBOpenRequest.onerror = function(event) {
+    note.innerHTML += '<li>Erreur lors du chargement de la base.</li>';
+  };
+
+  DBOpenRequest.onsuccess = function(event) {
+    note.innerHTML += '<li>Base chargée.</li>';
+
+    // affecte la connexion à la variable db
+    db = DBOpenRequest.result;
+
+    // fermeture de la base de donnée.
+    db.close();
+  }
+ +

Spécification

+ + + + + + + + + + + + + + +
SpécificationÉtatCommentaires
{{SpecName('IndexedDB', '#widl-IDBDatabase-close-void', 'close()')}}{{Spec2('IndexedDB')}} 
+ +

Compatibilité des navigateurs

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
FonctionnalitéChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Support simple23{{property_prefix("webkit")}}
+ 24
10 {{property_prefix("moz")}}
+ {{CompatGeckoDesktop("16.0")}}
10, en partie157.1
Disponible dans les web workers{{CompatVersionUnknown}}{{CompatGeckoMobile("37.0")}}{{CompatUnknown}}{{CompatVersionUnknown}}{{CompatUnknown}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FonctionnalitéAndroidFirefox Mobile (Gecko)Firefox OSIE PhoneOpera MobileSafari Mobile
Support simple4.4{{CompatGeckoMobile("22.0")}}1.0.110228
Disponible dans les web workers{{CompatVersionUnknown}}{{CompatGeckoMobile("37.0")}}{{CompatVersionUnknown}}{{CompatUnknown}}{{CompatVersionUnknown}}{{CompatUnknown}}
+
+ +

Voir aussi

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