Static
prefixedReturns all the handles we have cached.
Rest
...args: ArgumentMap<RepoEvents>[Extract<T, keyof RepoEvents>]Optional
context: anyCreate a new DocHandle by cloning the history of an existing DocHandle.
This is a wrapper around the clone
function in the Automerge library.
The new DocHandle
will have a new URL but will share history with the original,
which means that changes made to the cloned handle can be sensibly merged back
into the original.
Any peers this Repo
is connected to for whom sharePolicy
returns true
will
be notified of the newly created DocHandle.
if the cloned handle is not yet ready or if
clonedHandle.docSync()
returns undefined
(i.e. the handle is unavailable).
Creates a new document and returns a handle to it. The initial value of the document is an
empty object {}
unless an initial value is provided. Its documentId is generated by the
system. we emit a document
event to advertise interest in the document.
Optional
initialValue: TThe url or documentId of the handle to delete
Calls each of the listeners registered for a given event.
Rest
...args: ArgumentMap<RepoEvents>[Extract<T, keyof RepoEvents>]Return an array listing the events for which the emitter has registered listeners.
Exports a document to a binary format.
The url or documentId of the handle to export
Promise<Uint8Array | undefined> - A Promise containing the binary document, or undefined if the document is unavailable.
Return the number of listeners listening to a given event.
Return the listeners registered for a given event.
Optional
fn: ((...args) => void)Rest
...args: ArgumentMap<RepoEvents>[Extract<T, keyof RepoEvents>]Optional
context: anyOptional
once: booleanAdd a listener for a given event.
Rest
...args: ArgumentMap<RepoEvents>[Extract<T, keyof RepoEvents>]Optional
context: anyAdd a one-time listener for a given event.
Rest
...args: ArgumentMap<RepoEvents>[Extract<T, keyof RepoEvents>]Optional
context: anyRemove the listeners of a given event.
Optional
fn: ((...args) => void)Rest
...args: ArgumentMap<RepoEvents>[Extract<T, keyof RepoEvents>]Optional
context: anyOptional
once: boolean
The
Repo
is the main entry point of this libraryRemarks
To construct a
Repo
you will need an StorageAdapter and one or more NetworkAdapters. Once you have aRepo
you can use it to obtain DocHandles.