mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-06 11:37:02 +03:00
Fixed naming issue
This commit is contained in:
24
src/SB.ts
24
src/SB.ts
@@ -61,50 +61,50 @@ var SB: SBObject = {
|
|||||||
// Saves the changes to chrome.storage in json form
|
// Saves the changes to chrome.storage in json form
|
||||||
class MapIO {
|
class MapIO {
|
||||||
id: string;
|
id: string;
|
||||||
SBMap: SBMap<String, any>;
|
map: SBMap<String, any>;
|
||||||
|
|
||||||
constructor(id) {
|
constructor(id) {
|
||||||
// The name of the item in the array
|
// The name of the item in the array
|
||||||
this.id = id;
|
this.id = id;
|
||||||
// A local copy of the SBMap (SB.config.SBMapname.SBMap)
|
// A local copy of the SBMap (SB.config.SBMapname.SBMap)
|
||||||
this.SBMap = SB.localConfig[this.id];
|
this.map = SB.localConfig[this.id];
|
||||||
}
|
}
|
||||||
|
|
||||||
set(key, value) {
|
set(key, value) {
|
||||||
// Proxy to SBMap
|
// Proxy to SBMap
|
||||||
this.SBMap.set(key, value);
|
this.map.set(key, value);
|
||||||
// Store updated SBMap locally
|
// Store updated SBMap locally
|
||||||
chrome.storage.sync.set({
|
chrome.storage.sync.set({
|
||||||
[this.id]: encodeStoredItem(this.SBMap)
|
[this.id]: encodeStoredItem(this.map)
|
||||||
});
|
});
|
||||||
return this.SBMap;
|
return this.map;
|
||||||
}
|
}
|
||||||
|
|
||||||
get(key) {
|
get(key) {
|
||||||
return this.SBMap.get(key);
|
return this.map.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
has(key) {
|
has(key) {
|
||||||
return this.SBMap.has(key);
|
return this.map.has(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
size() {
|
size() {
|
||||||
return this.SBMap.size;
|
return this.map.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete(key) {
|
delete(key) {
|
||||||
// Proxy to SBMap
|
// Proxy to SBMap
|
||||||
this.SBMap.delete(key);
|
this.map.delete(key);
|
||||||
// Store updated SBMap locally
|
// Store updated SBMap locally
|
||||||
chrome.storage.sync.set({
|
chrome.storage.sync.set({
|
||||||
[this.id]: encodeStoredItem(this.SBMap)
|
[this.id]: encodeStoredItem(this.map)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
clear() {
|
clear() {
|
||||||
this.SBMap.clear();
|
this.map.clear();
|
||||||
chrome.storage.sync.set({
|
chrome.storage.sync.set({
|
||||||
[this.id]: encodeStoredItem(this.SBMap)
|
[this.id]: encodeStoredItem(this.map)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user