mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-02-24 07:25:10 +00:00
Styles: Fix disabling styles + order of operations when returning if the style was disabled
I have no idea how I didn't catch this sooner.
This commit is contained in:
parent
2595691a9e
commit
73e5110f6c
1 changed files with 7 additions and 9 deletions
|
@ -51,13 +51,12 @@ function findDocuments() {
|
||||||
export function enableStyle(style: Style | string) {
|
export function enableStyle(style: Style | string) {
|
||||||
if (typeof style === "string") style = requireStyle(style);
|
if (typeof style === "string") style = requireStyle(style);
|
||||||
|
|
||||||
|
const previousState = style.enabled;
|
||||||
|
|
||||||
style.enabled = true;
|
style.enabled = true;
|
||||||
compileStyle(style);
|
compileStyle(style);
|
||||||
|
|
||||||
if (style.enabled)
|
return !previousState;
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -74,13 +73,12 @@ export function disableStyle(style: Style | string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compileStyle(style);
|
const previousState = style.enabled;
|
||||||
|
|
||||||
if (!style.enabled)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
style.enabled = false;
|
style.enabled = false;
|
||||||
return true;
|
compileStyle(style);
|
||||||
|
|
||||||
|
return previousState;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue