mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-26 17:38:31 +03:00
Fixed SBMap not importing entries.
This commit is contained in:
13
src/SB.ts
13
src/SB.ts
@@ -9,6 +9,17 @@ interface SBObject {
|
|||||||
// Allows a SBMap to be conveted into json form
|
// Allows a SBMap to be conveted into json form
|
||||||
// Currently used for local storage
|
// Currently used for local storage
|
||||||
class SBMap<T, U> extends Map {
|
class SBMap<T, U> extends Map {
|
||||||
|
constructor(entries?: [T, U][]) {
|
||||||
|
super();
|
||||||
|
|
||||||
|
// Import all entries if they were given
|
||||||
|
if (entries !== undefined) {
|
||||||
|
for (const item of entries) {
|
||||||
|
this.set(entries[0], entries[1])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
toJSON() {
|
toJSON() {
|
||||||
return Array.from(this.entries());
|
return Array.from(this.entries());
|
||||||
}
|
}
|
||||||
@@ -205,7 +216,7 @@ function resetConfig() {
|
|||||||
|
|
||||||
function convertJSON() {
|
function convertJSON() {
|
||||||
Object.keys(SB.defaults).forEach(key => {
|
Object.keys(SB.defaults).forEach(key => {
|
||||||
SB.localConfig[key] = decodeStoredItem(SB.localConfig[key], key);
|
SB.localConfig[key] = decodeStoredItem(SB.localConfig[key]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user