示例工程 40-node-api-native-modules

40-node-api-native-modules/app/.tsc/shared/ipc.js

javascript · 0.8 KB

export const CH = {
    snapshot: "native:snapshot",
    hash: "native:hash",
    benchmark: "native:benchmark",
    setFallback: "native:set-fallback",
    reload: "native:reload",
    refresh: "native:refresh",
};
export function assertHashReq(value) {
    if (typeof value !== "object" || value === null) {
        throw new Error("BAD_HASH_REQ");
    }
    const text = value.text;
    if (typeof text !== "string" || text.length === 0 || text.length > 100_000) {
        throw new Error("BAD_HASH_TEXT");
    }
}
export function assertFallbackReq(value) {
    if (typeof value !== "object" || value === null) {
        throw new Error("BAD_FALLBACK_REQ");
    }
    if (typeof value.enabled !== "boolean") {
        throw new Error("BAD_FALLBACK_REQ");
    }
}
//# sourceMappingURL=ipc.js.map