type CollectionStatus = "idle" | "loading" | "initialCommit" | "ready" | "error" | "cleaned-up";
type CollectionStatus = "idle" | "loading" | "initialCommit" | "ready" | "error" | "cleaned-up";
定义于: packages/db/src/types.ts:335
用于生命周期管理的 collection 状态值
// Check collection status
if (collection.status === "loading") {
console.log("Collection is loading initial data")
} else if (collection.status === "ready") {
console.log("Collection is ready for use")
}
// Check collection status
if (collection.status === "loading") {
console.log("Collection is loading initial data")
} else if (collection.status === "ready") {
console.log("Collection is ready for use")
}
// Status transitions
// idle → loading → initialCommit → ready
// Any status can transition to → error or cleaned-up
// Status transitions
// idle → loading → initialCommit → ready
// Any status can transition to → error or cleaned-up
您的每周 JavaScript 资讯。每周一免费发送给超过 10 万开发者。