Accessing IndexedDB

Learn how to access an IndexedDB object from the browser.

Asynchronous nature

IndexedDB API is asynchronous, and once the requested operation is completed, its corresponding DOM Event is triggered. In other words, the triggered event type can help us identify whether the performed operation is successful or not.

IndexedDB supports transactionsThis is a group of operations that ensures the accuracy, completeness, and consistency of data. that ensure reliability. In a transaction, if one of the operations fails, then the applied operations are reverted, and the database returns to the previous stateThat’s the state it was before starting the transaction..

Overview of IndexedDB operations

The steps below demonstrate how we interact with IndexedDB:

  1. Create/Open a database. ...