tymondesigns / angular-locker

🗄️ A simple & configurable abstraction for local/session storage in angular js projects

Home Page:https://npm.im/angular-locker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem when trying to put or access multiple 'session' object.

SteveFidel opened this issue · comments

Hi,

I've got a weird issue while trying to set multiple session values using the latest release (2.0.1). My default driver option is 'local'.

So if I do the following:

locker.driver('session').put('sessionKey1', 1);
locker.driver('session').put('sessionKey2', 2);
locker.driver('local').put('localKey1', 1);
locker.driver('local').put('localKey2', 2);

"sessionKey1" is set as a SessionStorage, but all three others are set as LocalStorage. The problem here is that "sessionKey2" should have been a SessionStorage not LocalStorage.

But if I change the order like this:

locker.driver('session').put('sessionKey1', 1);
locker.driver('local').put('localKey1', 1);
locker.driver('session').put('sessionKey2', 2);
locker.driver('local').put('localKey2', 2);

Everything work as expected.

Yea, I have just reproduced this. it was caused by this line - https://github.com/tymondesigns/angular-locker/blob/master/src/angular-locker.js#L632

Will release a patch release for this shortly

Great, thanks for your quick replies.... really appreciated :)

done :) 2.0.2 should be available