示例工程 37-local-persistence
37-local-persistence/app/.tsc/shared/ipc.js
export const CH = {
snapshot: "store:snapshot",
addNote: "store:add-note",
reload: "store:reload",
corrupt: "store:corrupt-json",
bench: "store:bench",
refresh: "store:refresh",
};
export function assertAddNoteReq(value) {
if (typeof value !== "object" || value === null) {
throw new Error("BAD_NOTE_REQ");
}
const text = value.text;
if (typeof text !== "string")
throw new Error("BAD_NOTE_TEXT");
const trimmed = text.trim();
if (trimmed.length === 0 || trimmed.length > 500) {
throw new Error("BAD_NOTE_TEXT");
}
}
export function assertBenchReq(value) {
if (typeof value !== "object" || value === null) {
throw new Error("BAD_BENCH_REQ");
}
const count = value.count;
if (count !== 1000 && count !== 5000 && count !== 10000) {
throw new Error("BAD_BENCH_COUNT");
}
}
//# sourceMappingURL=ipc.js.map