abort
Summary
The abort method is used to abort a transaction. Once called, the abort method follows the steps to abort a transaction
Method of apis/indexeddb/IDBTransactionapis/indexeddb/IDBTransaction
Syntax
transaction.abort();
Return Value
No return value
Examples
var dbOpenRequest = window.indexedDB.open("BookShop1");
dbOpenRequest.onsuccess = function (event) {
var db = dbOpenRequest.result;
try {
var transaction = db.transaction(["ObjectStore_BookList"], IDBTransaction.READ_WRITE);
// Now that the transaction is created, lets abort it !!
transaction.abort();
} catch (e) {
write("Could not open transaction");
}
};
Usage
If the transaction is finished, a DOMException of type InvalidStateError is thrown. Otherwise, the steps to abort a transactions are run.
Related specifications
- W3C IndexedDB Specification
- W3C Proposed Recommendation
Attributions
Microsoft Developer Network: [Windows Internet Explorer API reference Article]