marcuswestin / store.js

Cross-browser storage for all use cases, used across the web.
MIT License
14.01k stars 1.33k forks source link

How to look for storage change across browser tabs? #267

Open ajinkyapisal opened 6 years ago

ajinkyapisal commented 6 years ago

I tried it by using store.observe and store.watch but both are working on the same tab where the event was created. Is there a way to do it across browser tabs? Thanks.

adarshmadrecha commented 6 years ago

I am also looking for this. I have posted a question on SO - https://stackoverflow.com/q/50580689

nbubna commented 6 years ago

Storage events are what you need. And these actually only work reliably from different windows/tabs, not in the same one: https://html5demos.com/storage-events/

My store2 library has an extension (store.on.js), but i'd be shocked if there weren't a plugin for Marcus' that supports storage events as well. Hopefully he'll chime in with more on that.