IndexedDB change observers

IndexedDB doesn’t have any observer support. This could normally be implemented by the needed website (or third party) as a wrapper around the database. However, IDB spans browsing contexts (tabs, workers, etc), and implementing a javascript wrapper that supports all of the needed features would be very difficult and performance optimization of the features would be impossible.

Use cases for observers include:

  • Updating the UI from database changes (data binding).
  • Syncing local state from background worker (like a ServiceWorker) or another tab making changes.
  • Serializing changes for network communication.
  • Simplified application logic.
1 Like

Did you look at ?

Thanks Dru & Philippe!

Any feedback on our spec at

would be helpful.

I also plan on updating updating the creation sematics to be more like IntersectionObserver here: and I’d love any feedback about that. (Note: that issue has some good examples usages as well)

1 Like

I like this idea to add observer support to current IndexedDB design for web developer to provide better experience and consistent data to the user when multiple tabs are open. The only concern/limitation so far to me is addressed in The transaction ordering has been confirmed to be restricted even if it’s an empty transaction. I’d still like to see if we can improve it instead of restricting it.

Thanks for your efforts to improve the use cases of the IndexedDB! :slight_smile:

Sounds great. @dmurph, can you move the repo to WICG?