@global-savings-group/extension-storage
Advanced tools
Comparing version 0.2.1 to 0.2.2
export class ChromeStorage { | ||
areaName; | ||
constructor(areaName) { | ||
this.areaName = areaName; | ||
this.onChanged = (key, callback) => { | ||
chrome.storage.onChanged.addListener((changes, areaName) => { | ||
if (areaName === this.areaName && changes[key]) { | ||
callback(changes[key].newValue, changes[key].oldValue); | ||
} | ||
}); | ||
}; | ||
} | ||
@@ -37,2 +31,9 @@ async get(name) { | ||
} | ||
onChanged = (key, callback) => { | ||
chrome.storage.onChanged.addListener((changes, areaName) => { | ||
if (areaName === this.areaName && changes[key]) { | ||
callback(changes[key].newValue, changes[key].oldValue); | ||
} | ||
}); | ||
}; | ||
getStorage() { | ||
@@ -39,0 +40,0 @@ return chrome.storage[this.areaName]; |
export class MemoryStorage { | ||
data = {}; | ||
constructor(data = {}) { | ||
this.data = {}; | ||
this.data = data; | ||
@@ -5,0 +5,0 @@ } |
{ | ||
"name": "@global-savings-group/extension-storage", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Cross-browser storage service for browser extensions", | ||
@@ -5,0 +5,0 @@ "author": "Global Savings Group", |
112
4817