mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-17 21:18:56 +03:00
Save Map content
This commit is contained in:
11
SB.js
11
SB.js
@@ -21,9 +21,9 @@ class MapIO {
|
|||||||
|
|
||||||
set(key, value) {
|
set(key, value) {
|
||||||
this.map.set(key, value);
|
this.map.set(key, value);
|
||||||
|
chrome.storage.sync.set({
|
||||||
SB.config.handler.set(undefined, this.id, encodeStoredItem(this.map));
|
[this.id]: encodeStoredItem(this.map)
|
||||||
|
});
|
||||||
return this.map;
|
return this.map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,6 +38,9 @@ class MapIO {
|
|||||||
deleteProperty(key) {
|
deleteProperty(key) {
|
||||||
if (this.map.has(key)) {
|
if (this.map.has(key)) {
|
||||||
this.map.delete(key);
|
this.map.delete(key);
|
||||||
|
chrome.storage.sync.set({
|
||||||
|
[this.id]: encodeStoredItem(this.map)
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@@ -50,8 +53,6 @@ class MapIO {
|
|||||||
|
|
||||||
delete(key) {
|
delete(key) {
|
||||||
this.map.delete(key);
|
this.map.delete(key);
|
||||||
|
|
||||||
SB.config.handler.set(undefined, this.id, encodeStoredItem(this.map));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user