Closed alvinlindstam closed 7 years ago
Looking at the travis log, it seems that there is some credential issue preventing the tests from running rather than test failures in this branch.
Thanks again! Will try to look at the PR this week :)
Have you had a chance to look at this, @danielstjules?
I would also like to see this or a similar feature if possible. Thank you for your time!
Unlike localStorage events, it looks like these would fire to all clients, including the source of the change
https://html.spec.whatwg.org/multipage/webstorage.html#the-localstorage-attribute
When the setItem(), removeItem(), and clear() methods are called on a Storage object x that is associated with a local storage area, if the methods did not throw an exception or "do nothing" as defined above, then for every Document object whose Window object's localStorage attribute's Storage object is associated with the same storage area, other than x, send a storage notification.
@danielstjules: The Hub uses the localStorage event, so the client that initiates the change will not get an event since the hub does not. Also, if multiple clients somehow use the same hub window, they won't get any updates when the other clients update the data.
Since this was a pretty old PR, I didn't want to bother you with changes. I've squashed it and am taking it over in another branch. Thank you so much! :)
We needed to be updated when another window changed a value, so this PR implements forwarding
storage
events from the hub to the client.Resolves initial request in https://github.com/zendesk/cross-storage/issues/19. It tries to behave like the storage event as much as possible, rather than implementing own event for different types of requests. This also means that no events will be sent from hubs that actually make the changes.
Feedback appreciated, I'm not sure if I've followed all conventions of the library or if the API is the best available.