Get notified when indexedDB entry gets changed in other tab

Dexie 3.2 has observability built-in (without Dexie.Observable). It uses BroadcastChannel to communicate changes across browsing contexts. It can only observe changes that are made using Dexie>=3.2 (as there is still no stable native API to do this).


Update

  1. Dexie has an add-on for Observables now, in case you start with a new project: https://dexie.org/docs/Observable/Dexie.Observable
  2. Oleg did a solid hook on the Ionic storage wrapper. But that can be created for any local storage library. Solid engineering. https://medium.com/@OlegVaraksin/how-to-make-ionic-storage-reactive-acdd8996f1e6

There's no current "observer" API defined for Indexed DB. However, it's on the feature request list and there are similar proposals from both Mozilla and Google.

https://github.com/w3c/IndexedDB/issues/51

Which is to say: yes, you need to come up with some custom cross-tab communication mechanism, such as polling, storage events, setting up MessageChannel links (Chrome), BroadcastChannel (Firefox), or using a Service Worker as a relay between clients.


NEWS FLASH!

Chrome has an experimental Indexed DB Observers API. You need to run chrome with --enable-experimental-web-platform-features to use it so it's not useful in production yet. We'd love to get feedback on it - file bugs on the github repo.