From c05efa8d7ae464235cf83d7c0956e42dc6974103 Mon Sep 17 00:00:00 2001 From: julieng Date: Sat, 2 Oct 2021 17:20:14 +0200 Subject: move *.html to *.md --- .../web/api/idbobjectstore/transaction/index.html | 106 --------------------- .../fr/web/api/idbobjectstore/transaction/index.md | 106 +++++++++++++++++++++ 2 files changed, 106 insertions(+), 106 deletions(-) delete mode 100644 files/fr/web/api/idbobjectstore/transaction/index.html create mode 100644 files/fr/web/api/idbobjectstore/transaction/index.md (limited to 'files/fr/web/api/idbobjectstore/transaction') diff --git a/files/fr/web/api/idbobjectstore/transaction/index.html b/files/fr/web/api/idbobjectstore/transaction/index.html deleted file mode 100644 index 92c8a187db..0000000000 --- a/files/fr/web/api/idbobjectstore/transaction/index.html +++ /dev/null @@ -1,106 +0,0 @@ ---- -title: IDBObjectStore.transaction -slug: Web/API/IDBObjectStore/transaction -translation_of: Web/API/IDBObjectStore/transaction ---- -

{{ APIRef("IndexedDB") }}

- -
-

La propriété transaction de l'interface {{domxref("IDBObjectStore")}} renvoie la {{domxref("IDBTransaction","transaction")}} à laquelle l'{{domxref("IDBObjectStore","accès")}} du magasin d'objet appartient.

- -

{{AvailableInWorkers}}

-
- -

Syntaxe

- -
var myTransaction = objectStore.transaction;
- -

Valeur

- -

Une {{domxref("IDBTransaction","transaction")}}.

- -

Exemple

- -

Dans le code suivant, on ouvre une {{domxref("IDBDatabase","connexion")}} à la base de donnée. Sur cette connexion on démarre une {{domxref("IDBTransaction","transaction")}} en lecture/écriture pour avoir un {{domxref("IDBObjectStore","accès")}} au magasin d'objet "toDoList" dans lequel on {{domxref("IDBObjectStore.add","ajoute")}} un enregistrement.

- -

La propriété transaction affiche la transaction à laquelle l'accès du magasin d'objet appartient.

- -
//Connexion à la base de données
-var DBOpenRequest = window.indexedDB.open("toDoList", 4);
-
-DBOpenRequest.onsuccess = function(event) {
-	note.innerHTML += '<li>Connexion établie.</li>';
-
-	//Affecte la connexion à la variable db.
-	db = DBOpenRequest.result;
-
-	// Exécutez la fonction addData () pour ajouter un enregistrement au magasin d'objet
-	addData();
-};
-function addData() {
-	// un nouvel objet prêt à être emmagasiné
-	newItem = [ { taskTitle: "Walk dog", hours: 19, minutes: 30, day: 24, month: "December", year: 2013, notified: "no" } ];
-
-	// ouvre une transaction de lecture / écriture  prête au traitement des données sur la connexion
-	var transaction = db.transaction(["toDoList"], "readwrite");
-
-	// en cas de succès de l'ouverture de la transaction
-	transaction.oncomplete = function(event) {
-		note.innerHTML += '<li>Transaction complété : modification de la base de données terminée.</li>';
-	};
-	// en  cas d'échec de l'ouverture de la transaction
-	transaction.onerror = function(event) {
-		note.innerHTML += '<li>L\'erreur: "' + transaction.error +'" c\'est produite échec de la transaction.</li>';
-	};
-
-	// ouvre l'accès au un magasin "toDoList" de la transaction
-	var objectStore = transaction.objectStore("toDoList");
-
-//->Affiche la transaction de l'accès du magasin d'objet
-    console.log(objectStore.transaction);
-
-	// Ajoute un enregistrement
-	var objectStoreRequest = objectStore.add(newItem[0]);
-	objectStoreRequest.onsuccess = function(event) {
-		// signale l'ajout de l'enregistrement
-		note.innerHTML += '<li>Enregistrement ajouté.</li>';
-	};
- };
- 
- -
-

Note : Pour un exemple de travail complet, voir notre To-do Notifications app (view example live).

-
- -

Spécifications

- - - - - - - - - - - - - - -
SpécificationStatutCommentaire
{{SpecName('IndexedDB', '#widl-IDBObjectStore-transaction', 'transaction')}}{{Spec2('IndexedDB')}} 
- -

Compatibilité des navigateurs

- -

{{Compat("api.IDBObjectStore.transaction")}}

- -

Voir aussi

- - diff --git a/files/fr/web/api/idbobjectstore/transaction/index.md b/files/fr/web/api/idbobjectstore/transaction/index.md new file mode 100644 index 0000000000..92c8a187db --- /dev/null +++ b/files/fr/web/api/idbobjectstore/transaction/index.md @@ -0,0 +1,106 @@ +--- +title: IDBObjectStore.transaction +slug: Web/API/IDBObjectStore/transaction +translation_of: Web/API/IDBObjectStore/transaction +--- +

{{ APIRef("IndexedDB") }}

+ +
+

La propriété transaction de l'interface {{domxref("IDBObjectStore")}} renvoie la {{domxref("IDBTransaction","transaction")}} à laquelle l'{{domxref("IDBObjectStore","accès")}} du magasin d'objet appartient.

+ +

{{AvailableInWorkers}}

+
+ +

Syntaxe

+ +
var myTransaction = objectStore.transaction;
+ +

Valeur

+ +

Une {{domxref("IDBTransaction","transaction")}}.

+ +

Exemple

+ +

Dans le code suivant, on ouvre une {{domxref("IDBDatabase","connexion")}} à la base de donnée. Sur cette connexion on démarre une {{domxref("IDBTransaction","transaction")}} en lecture/écriture pour avoir un {{domxref("IDBObjectStore","accès")}} au magasin d'objet "toDoList" dans lequel on {{domxref("IDBObjectStore.add","ajoute")}} un enregistrement.

+ +

La propriété transaction affiche la transaction à laquelle l'accès du magasin d'objet appartient.

+ +
//Connexion à la base de données
+var DBOpenRequest = window.indexedDB.open("toDoList", 4);
+
+DBOpenRequest.onsuccess = function(event) {
+	note.innerHTML += '<li>Connexion établie.</li>';
+
+	//Affecte la connexion à la variable db.
+	db = DBOpenRequest.result;
+
+	// Exécutez la fonction addData () pour ajouter un enregistrement au magasin d'objet
+	addData();
+};
+function addData() {
+	// un nouvel objet prêt à être emmagasiné
+	newItem = [ { taskTitle: "Walk dog", hours: 19, minutes: 30, day: 24, month: "December", year: 2013, notified: "no" } ];
+
+	// ouvre une transaction de lecture / écriture  prête au traitement des données sur la connexion
+	var transaction = db.transaction(["toDoList"], "readwrite");
+
+	// en cas de succès de l'ouverture de la transaction
+	transaction.oncomplete = function(event) {
+		note.innerHTML += '<li>Transaction complété : modification de la base de données terminée.</li>';
+	};
+	// en  cas d'échec de l'ouverture de la transaction
+	transaction.onerror = function(event) {
+		note.innerHTML += '<li>L\'erreur: "' + transaction.error +'" c\'est produite échec de la transaction.</li>';
+	};
+
+	// ouvre l'accès au un magasin "toDoList" de la transaction
+	var objectStore = transaction.objectStore("toDoList");
+
+//->Affiche la transaction de l'accès du magasin d'objet
+    console.log(objectStore.transaction);
+
+	// Ajoute un enregistrement
+	var objectStoreRequest = objectStore.add(newItem[0]);
+	objectStoreRequest.onsuccess = function(event) {
+		// signale l'ajout de l'enregistrement
+		note.innerHTML += '<li>Enregistrement ajouté.</li>';
+	};
+ };
+ 
+ +
+

Note : Pour un exemple de travail complet, voir notre To-do Notifications app (view example live).

+
+ +

Spécifications

+ + + + + + + + + + + + + + +
SpécificationStatutCommentaire
{{SpecName('IndexedDB', '#widl-IDBObjectStore-transaction', 'transaction')}}{{Spec2('IndexedDB')}} 
+ +

Compatibilité des navigateurs

+ +

{{Compat("api.IDBObjectStore.transaction")}}

+ +

Voir aussi

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