createDocumentStore
Call Signature
Section titled “Call Signature”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.
Type Parameters
Section titled “Type Parameters”Doc
Change
Section titled “Change”Change
PublicKey
Section titled “PublicKey”PublicKey
Parameters
Section titled “Parameters”createHandle
Section titled “createHandle”DocumentHandleFactory<Doc, Change, PublicKey>
options?
Section titled “options?”DocumentStoreOptions & object
Returns
Section titled “Returns”DocumentStore<Doc, Change, PublicKey>
Call Signature
Section titled “Call Signature”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.
Type Parameters
Section titled “Type Parameters”Doc
Change
Section titled “Change”Change
PublicKey
Section titled “PublicKey”PublicKey
Parameters
Section titled “Parameters”document
Section titled “document”DocumentHandle<Doc, Change, PublicKey>
options
Section titled “options”DocumentStoreOptions & object
Returns
Section titled “Returns”DocumentStore<Doc, Change, PublicKey>