Comments and added delete

This commit is contained in:
Official Noob
2020-01-16 17:57:54 +00:00
committed by GitHub
parent 3e3b8eab6f
commit 251339f26b

9
SB.js
View File

@@ -20,7 +20,9 @@ class MapIO {
} }
set(key, value) { set(key, value) {
// Proxy to map
this.map.set(key, value); this.map.set(key, value);
// Store updated map locally
chrome.storage.sync.set({ chrome.storage.sync.set({
[this.id]: encodeStoredItem(this.map) [this.id]: encodeStoredItem(this.map)
}); });
@@ -37,7 +39,9 @@ class MapIO {
deleteProperty(key) { deleteProperty(key) {
if (this.map.has(key)) { if (this.map.has(key)) {
// Proxy to map
this.map.delete(key); this.map.delete(key);
// Store updated map locally
chrome.storage.sync.set({ chrome.storage.sync.set({
[this.id]: encodeStoredItem(this.map) [this.id]: encodeStoredItem(this.map)
}); });
@@ -52,7 +56,12 @@ class MapIO {
} }
delete(key) { delete(key) {
// Proxy to map
this.map.delete(key); this.map.delete(key);
// Store updated map locally
chrome.storage.sync.set({
[this.id]: encodeStoredItem(this.map)
});
} }
} }