mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-10 09:07:45 +01:00
Save Map content
This commit is contained in:
parent
a7d769dd6d
commit
3e3b8eab6f
1 changed files with 6 additions and 5 deletions
11
SB.js
11
SB.js
|
@ -21,9 +21,9 @@ class MapIO {
|
|||
|
||||
set(key, value) {
|
||||
this.map.set(key, value);
|
||||
|
||||
SB.config.handler.set(undefined, this.id, encodeStoredItem(this.map));
|
||||
|
||||
chrome.storage.sync.set({
|
||||
[this.id]: encodeStoredItem(this.map)
|
||||
});
|
||||
return this.map;
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,9 @@ class MapIO {
|
|||
deleteProperty(key) {
|
||||
if (this.map.has(key)) {
|
||||
this.map.delete(key);
|
||||
chrome.storage.sync.set({
|
||||
[this.id]: encodeStoredItem(this.map)
|
||||
});
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -50,8 +53,6 @@ class MapIO {
|
|||
|
||||
delete(key) {
|
||||
this.map.delete(key);
|
||||
|
||||
SB.config.handler.set(undefined, this.id, encodeStoredItem(this.map));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue