You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was looking for a way to subscribe to updates in another window using localStorage and thus stumbled upon your wonderful library!
However, I soon realized that there is no usual way to subscribe between windows, since IndexedDB is mainly used.
After a little thought, I ended up with this simple code. See example.
In short:
After adding the value to localForage, we write the hash of the value to localStorage.
We are subscribed to storage - where we specify that the update concerns our component.
If we are satisfied with everything, we get a key that has changed in another window, we make a request for it and the action that needs to be done in order to "level" the state with the previous window.
It seems to me that this is an acceptable option, because he is flexible enough.
I am interested in your opinion.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I was looking for a way to subscribe to updates in another window using localStorage and thus stumbled upon your wonderful library!
However, I soon realized that there is no usual way to subscribe between windows, since IndexedDB is mainly used.
After a little thought, I ended up with this simple code. See example.
In short:
It seems to me that this is an acceptable option, because he is flexible enough.
I am interested in your opinion.
Beta Was this translation helpful? Give feedback.
All reactions