Files
BetterSEQTA-Plus/src/seqta/utils/settingsNavigation.ts
T

24 lines
732 B
TypeScript

export type SettingsDestination =
| { page: "settings"; section?: string; search?: string }
| {
page: "themes" | "backgrounds";
view?: "settings" | "store" | "community" | "custom";
};
export const SETTINGS_NAVIGATION_EVENT = "bsplus:navigate-settings";
let pendingDestination: SettingsDestination | null = null;
export function requestSettingsDestination(destination: SettingsDestination): void {
pendingDestination = destination;
window.dispatchEvent(
new CustomEvent(SETTINGS_NAVIGATION_EVENT, { detail: destination }),
);
}
export function consumeSettingsDestination(): SettingsDestination | null {
const destination = pendingDestination;
pendingDestination = null;
return destination;
}