From ed2cdde0fcac015370e49ba81849d4d56bd80943 Mon Sep 17 00:00:00 2001 From: Michael Sund Date: Mon, 18 Jul 2016 16:16:43 +0200 Subject: [PATCH] fixed storagetype switching --- src/storage.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/storage.ts b/src/storage.ts index 3eefbc8b..29c0666b 100644 --- a/src/storage.ts +++ b/src/storage.ts @@ -9,12 +9,11 @@ export default class Storage { constructor(private $window: angular.IHttpService, private SatellizerConfig: Config) { this.memoryStore = {}; - this.storageType = SatellizerConfig.storageType; } get(key: string): string { try { - return this.$window[this.storageType].getItem(key); + return this.$window[this.SatellizerConfig.storageType].getItem(key); } catch (e) { return this.memoryStore[key]; } @@ -22,7 +21,7 @@ export default class Storage { set(key: string, value: string): void { try { - this.$window[this.storageType].setItem(key, value); + this.$window[this.SatellizerConfig.storageType].setItem(key, value); } catch (e) { this.memoryStore[key] = value; } @@ -30,7 +29,7 @@ export default class Storage { remove(key: string): void { try { - this.$window[this.storageType].removeItem(key); + this.$window[this.SatellizerConfig.storageType].removeItem(key); } catch (e) { delete this.memoryStore[key]; }