gsklee / ngStorage

localStorage and sessionStorage done right for AngularJS.
MIT License
2.34k stars 461 forks source link

Add $ngStorageChanged event after apply with changes #239

Open schmuli opened 7 years ago

schmuli commented 7 years ago

If we detect changes during the apply phase, we broadcast a $ngStorageChanged event on the $rootScope.

Additionally, since we also detect any changes to the underlying storage and apply those in the same manner, this event will be broadcast when the change might have come from a different tab.

Fixes #214

schmuli commented 7 years ago

Sorry about the formatting in the test, my VI isn't setup correctly for JS.

Also, currently I only implemented one event which will be fired for both storage services, local and session. It should be trivial to add an indicator as part of the event data from which service the event was broadcast.

dr3am3r commented 7 years ago

any update on this?

egilkh commented 7 years ago

Seems like a good addition. Will merge.

schmuli commented 7 years ago

@egilkh Any chance of getting this merged any time soon?

Thanks.