示例工程 22-theming-and-native-appearance

22-theming-and-native-appearance/app/.tsc/shared/ipc.js

javascript · 0.5 KB

export const CH = {
    themeGet: "theme:get",
    themeSet: "theme:set",
    themeChanged: "theme:changed",
};
const SOURCES = ["system", "light", "dark"];
export function isThemeSource(value) {
    return typeof value === "string" && SOURCES.includes(value);
}
export function assertThemeSet(value) {
    if (typeof value !== "object" || value === null) {
        throw new Error("BAD_THEME_REQ");
    }
    const source = value.source;
    if (!isThemeSource(source))
        throw new Error("BAD_THEME_SOURCE");
}
//# sourceMappingURL=ipc.js.map