Files
Papo/public/ts-build/ui/switch.js
Pascal Prießnitz 7a296f7b4a
All checks were successful
Deploy Discord Bot / deploy (push) Successful in 38s
[deploy] Emit frontend bundle as ESM for browser
2025-12-04 17:06:27 +01:00

15 lines
379 B
JavaScript

export function toggleSwitch(el, force) {
if (!el)
return;
const next = force === undefined ? !el.classList.contains('on') : force;
el.classList.toggle('on', next);
}
export function getSwitch(el) {
return el?.classList.contains('on') ?? false;
}
export function setSwitch(el, value) {
if (!el)
return;
el.classList.toggle('on', value);
}