PSA: New Promise-based IndexedDB.jsm module

Kris Maglione kmaglione at
Sun Mar 26 02:27:19 UTC 2017

A couple of weeks ago, I added a new Promise-based IndexedDB 
helper module as part of some performance work I was doing:

If you've been avoiding IndexedDB because of the verbose and
difficult-to-work-with API, I encourage you to give it a try. There are
a lot of advantages to using IndexedDB for storage, particularly the fully 
async API and use of structured clone for data serialization. With this 
module, a basic database access is as simple as:

  let db = await
    "fooDB", {storage: "persistent", version: 1}, db => {

  await db.objectStore("foo", "readwrite")
          .set("bar", {baz: "quux"});

  let val = await db.objectStore("foo").get("bar");

Please let me know if you have any questions or suggestions.


More information about the firefox-dev mailing list