Skip to content

Commit cd51f4e

Browse files
author
Joseph Podwys
committed
Fixing an error that caused cacheModule to default to sessionStorage.
1 parent a26e0fe commit cd51f4e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

cacheModule.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,9 @@ function cacheModule(config){
186186
storageKey = 'cache-module-storage-mock';
187187
}
188188
else{
189-
var storageType = (config.storage === 'local') ? 'local' : 'session';
190-
store = (typeof Storage !== void(0)) ? window[storageType + 'Storage'] : false;
191-
storageKey = 'cache-module-' + storageType + '-storage';
189+
var storageType = (config.storage === 'local' || config.storage === 'session') ? config.storage : null;
190+
store = (storageType && typeof Storage !== void(0)) ? window[storageType + 'Storage'] : false;
191+
storageKey = (storageType) ? 'cache-module-' + storageType + '-storage' : null;
192192
}
193193
if(store){
194194
var db = store.getItem(storageKey);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cache-service-cache-module",
3-
"version": "1.2.1",
3+
"version": "1.2.2",
44
"description": "A cache plugin for cache-service.",
55
"main": "cacheModule.js",
66
"devDependencies": {

0 commit comments

Comments
 (0)