1
0
mirror of https://github.com/zumbiepig/MineXLauncher.git synced 2025-06-08 07:54:49 +00:00

add toggle function

This commit is contained in:
zumbiepig 2024-08-31 15:47:08 -07:00
parent 87379f5a93
commit e1c382be28
No known key found for this signature in database
GPG Key ID: 17C891BE28B953DE

View File

@ -287,6 +287,18 @@ const mods = {
storage.local.set('mods', mods); storage.local.set('mods', mods);
} }
}, },
toggle: function (mod: string): void {
const mods: string[] = storage.local.get('mods') ?? [];
const modIndex = mods.indexOf(mod);
if (modIndex === -1) {
mods.push(mod);
mods.sort();
storage.local.set('mods', mods);
} else {
mods.splice(modIndex, 1);
storage.local.set('mods', mods);
}
}
}; };
const serviceworker = { const serviceworker = {