zendesk / cross-storage

Cross domain local storage, with permissions
Apache License 2.0
2.22k stars 180 forks source link

Updating storage #28

Closed bhuranideepak82 closed 8 years ago

bhuranideepak82 commented 8 years ago

Is there anyway i can update the storage?

As of now we call below method initially and when value updated

menuService.prototype.setMenuStructureInLocalStorage = function (menuStructureKey, menuStructure) {

    var crossDomainStorage = new CrossStorageClient('localstoragehub.html');
    var setCrossDomainStorageKeys = function () {
        return crossDomainStorage.set(that.constants.MENU_STORAGE_KEY.COMBINED_MENU_STRUCTURE_XT, menuStructure);
    };
    crossDomainStorage.onConnect()
    .then(setCrossDomainStorageKeys);
};

But it does not update it.. It always has old values

danielstjules commented 8 years ago

Looking at the console, is the client able to connect? Do you see any errors?

bhuranideepak82 commented 8 years ago

no errors...works but with old value...not new

On Jul 22, 2016 6:45 PM, "Daniel St. Jules" notifications@github.com wrote:

Looking at the console, is the client able to connect? Do you see any errors?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/zendesk/cross-storage/issues/28#issuecomment-234674917, or mute the thread https://github.com/notifications/unsubscribe-auth/AGsCuSM06CBVv0GynaeuNz8xdpX-A5_8ks5qYUf6gaJpZM4JTLdi .

danielstjules commented 8 years ago

Can you post a full example somewhere? The tests validate that overwriting existing values works https://github.com/zendesk/cross-storage/blob/master/test/test.js#L255-L267

bhuranideepak82 commented 8 years ago

I figured out the issue.

Issue turned out to be making two or more simultaneous calls for connect hence overwrite.

I implemented locking and not letting other request go when one is being processed.

You can close this issue or I will add a comment on it.

I really appreciate your prompt replies.

On 23 July 2016 at 16:05, Daniel St. Jules notifications@github.com wrote:

Can you post a full example somewhere? The tests validate that overwriting existing values works https://github.com/zendesk/cross-storage/blob/master/test/test.js#L255-L267

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/zendesk/cross-storage/issues/28#issuecomment-234737420, or mute the thread https://github.com/notifications/unsubscribe-auth/AGsCuYXwSVexos3SYZNpxVIk_2O2q-81ks5qYnP7gaJpZM4JTLdi .

With Regards,

Deepak Bhurani

Contact : 614-707-9974

danielstjules commented 8 years ago

Glad you figured it out!