Skip to content

createDocumentStore

createDocumentStore<Doc, Change, PublicKey>(createHandle, options?): DocumentStore<Doc, Change, PublicKey>

Defined in: index.ts:131

Create one store per node/document path and share it between consumers. Construction and subscription are safe during server rendering. Call start() or connect() in the browser to open the document. Changes retain their promise.

A managed store calls createHandle, such as () => peerborne.doc(path), for every open and closes that handle when it stops. It never reopens a closed handle: a durable BeeKEM fork guard or coordinated document refuses. While a delivery failure is outstanding, the final release keeps the document open for undeliveredCloseDelay, because the undelivered change exists only in that handle. A fresh handle loads the document from a peer, so a remount after a close needs a connected peer that holds it, or a factory that restores the document’s latest checkpoint with restoreEncryptedCheckpoint() before returning the handle.

Doc

Change

PublicKey

DocumentHandleFactory<Doc, Change, PublicKey>

DocumentStoreOptions & object

DocumentStore<Doc, Change, PublicKey>

createDocumentStore<Doc, Change, PublicKey>(document, options): DocumentStore<Doc, Change, PublicKey>

Defined in: index.ts:136

An unmanaged store subscribes to a handle that the caller opens and closes.

Doc

Change

PublicKey

DocumentHandle<Doc, Change, PublicKey>

DocumentStoreOptions & object

DocumentStore<Doc, Change, PublicKey>