示例工程 32-deep-links-file-association

32-deep-links-file-association/app/.tsc/shared/ipc.js

javascript · 0.9 KB

export const CH = {
    get: "links:get",
    simulateUrl: "links:simulate-url",
    simulateFile: "links:simulate-file",
    simulateSecond: "links:simulate-second",
    clear: "links:clear",
    changed: "links:changed",
};
export function assertUrlReq(value) {
    if (typeof value !== "object" || value === null) {
        throw new Error("BAD_URL_REQ");
    }
    const url = value.url;
    if (typeof url !== "string" || url.length === 0 || url.length > 4096) {
        throw new Error("BAD_URL_REQ");
    }
}
export function assertFileReq(value) {
    if (typeof value !== "object" || value === null) {
        throw new Error("BAD_FILE_REQ");
    }
    const filePath = value.path;
    if (typeof filePath !== "string" ||
        filePath.length === 0 ||
        filePath.length > 4096) {
        throw new Error("BAD_FILE_REQ");
    }
}
//# sourceMappingURL=ipc.js.map