Functions
Functions
mountDevtoolsHooks(options)
Returns: void
Arguments:
options
: MountOptions
unmountDevtoolsHooks()
Returns: void
Arguments: none
useDevtools()
Returns: DevtoolsHost
Arguments: none
useStream(streamFactory, defaultValue, deps)
Subscribe to service API streams.
Returns: T
Arguments:
streamFactory
: function
defaultValue
: T
deps
: DependencyList
createDocAccessor(text)
Returns: DocAccessor<T>
Arguments:
text
: TextObject | EchoReactiveObject<object>
createSubscription(onUpdate)
Subscribe to database updates. Calls the callback when any object from the selection changes. Calls the callback when the selection changes. Always calls the callback on the first selection.update
call.
Returns: SubscriptionHandle
Arguments:
onUpdate
: function
fromCursor(object, cursor)
Returns: number
Arguments:
object
: TextObject
cursor
: string
getRawDoc(obj, [path])
Returns: DocAccessor<any>
Arguments:
obj
: OpaqueEchoObject
path
: KeyPath
getSpaceForObject(object)
Returns: undefined | Space
Arguments:
object
: OpaqueEchoObject
getTextContent(object, defaultValue)
Returns: string
Arguments:
object
: undefined | TextObject | EchoReactiveObject<object>
defaultValue
: string
getTextInRange(object, begin, end)
TODO(dima?): This API will change.
Returns: string
Arguments:
object
: TextObject
begin
: string
end
: string
hasType(schema)
Returns: function
Arguments:
schema
: Schema
isAutomergeObject(object)
Returns: object is AutomergeObject
Arguments:
object
: unknown
isTypedObject(object)
Returns: object is TypedObject<Record<string, any>>
Arguments:
object
: unknown
setTextContent(object, text)
Returns: void
Arguments:
object
: TextObject
text
: string
toCursor(object, pos)
Returns: string
Arguments:
object
: TextObject
pos
: number
useMembers(spaceKey)
Returns: SpaceMember[]
Arguments:
spaceKey
: undefined | PublicKey
useQuery([space], [filter], [options], [deps])
Create subscription.
Returns: T[]
Arguments:
space
: Space
filter
: FilterSource<T>
options
: QueryOptions
deps
: any[]
useSpace([spaceKey])
Get a specific Space using its key. The space is not guaranteed to be in the ready state. Returns the default space if no key is provided. Requires a ClientProvider somewhere in the parent tree.
Returns: undefined | Space
Arguments:
spaceKey
: PublicKeyLike
useSpaceInvitation([spaceKey], [invitationId])
Returns: InvitationStatus
Arguments:
spaceKey
: PublicKey
invitationId
: string
useSpaceInvitations([spaceKey])
Returns: CancellableInvitation[]
Arguments:
spaceKey
: PublicKey
useSpaces(options)
Get all Spaces available to current user. Requires a ClientProvider somewhere in the parent tree. By default, only ready spaces are returned.
Returns: Space[]
Arguments:
options
: UseSpacesParams
useSubscription(cb, selection)
Create reactive selection. Calls the callback when the selection changes and during the first render.
Returns: undefined | SubscriptionHandle
Arguments:
cb
: function
selection
: Selection
useContacts()
Returns all known Contacts across all Spaces. Contacts are known members of a common Space. Requires ClientContext to be set via ClientProvider.
Returns: Contact[]
Arguments: none
useDevices()
Returns: Device[]
Arguments: none
useHaloInvitation([invitationId])
Returns: InvitationStatus
Arguments:
invitationId
: string
useHaloInvitations()
Returns: CancellableInvitation[]
Arguments: none
useIdentity()
Hook returning DXOS identity object. Requires ClientContext to be set via ClientProvider.
Returns: "null" | Identity
Arguments: none
useKeyStore(defaultKeys)
Settings store.
Returns: [Map<string, string>, function]
Arguments:
defaultKeys
: string[]
ClientProvider(options)
Root component that provides the DXOS client instance to child components. To be used with the useClient
hook.
Returns: Element
Arguments:
options
: ClientProviderProps
Defaults([basePath])
JSON config.
Returns: Partial<Config>
Arguments:
basePath
: string
Dynamics()
Provided dynamically by server.
Returns: Partial<Config>
Arguments: none
Envs([basePath])
ENV variable (key/value) map.
Returns: Partial<Config>
Arguments:
basePath
: string
Local()
Development config.
Returns: Partial<Config>
Arguments: none
Remote(target)
Returns: Partial<Config>
Arguments:
target
: undefined | string
Storage()
Load config from storage.
Returns: Promise<Partial<Config>>
Arguments: none
createClientServices(config, [createWorker])
Create services from config.
Returns: Promise<ClientServicesProvider>
Arguments:
config
: Config
createWorker
: function
fromAgent([options])
Connects to locally running CLI daemon.
Returns: ClientServicesProvider
Arguments:
options
: FromAgentOptions
fromHost([config], [params])
Creates stand-alone services without rpc.
Returns: Promise<ClientServicesProvider>
Arguments:
config
: Config
params
: ClientServicesHostParams
fromIFrame([config], [options])
Create services provider proxy connected via iFrame to host.
Returns: Promise<ClientServicesProvider>
Arguments:
config
: Config
options
: Omit<Partial<IFrameClientServicesProxyOptions>, "source">
fromSocket(url)
Access to remote client via a socket.
Returns: Promise<ClientServicesProvider>
Arguments:
url
: string
fromWorker(config, options)
Creates services provider connected via worker.
Returns: Promise<WorkerClientServices>
Arguments:
config
: undefined | Config
options
: Omit<WorkerClientServicesParams, "config">
getUnixSocket(profile, [protocol])
Returns: string
Arguments:
profile
: string
protocol
: string
useAgentHostingProviderClient(config)
Returns: "null" | AgentHostingProviderClient
Arguments:
config
: Config
useClient()
Hook returning instance of DXOS client. Requires ClientContext to be set via ClientProvider.
Returns: Client
Arguments: none
useClientServices()
Returns: undefined | ClientServices
Arguments: none
useConfig()
Hook returning config object used to initialize the DXOS client instance. Requires ClientContext to be set via ClientProvider.
Returns: Config
Arguments: none
useMulticastObservable(observable)
Subscribe to a MulticastObservable and return the latest value.
Returns: T
Arguments:
observable
: MulticastObservable<T>
useShell()
Helper hook to access the shell.
Returns: Shell
Arguments: none
useStatus()
Returns: undefined | "null" | SystemStatus
Arguments: none
useInvitationStatus([initialObservable])
Returns: InvitationStatus
Arguments:
initialObservable
: CancellableInvitation
useNetworkStatus()
Creates a network status subscription.
Returns: NetworkStatus
Arguments: none
onconnect(event)
Returns: Promise<void>
Arguments:
event
: MessageEvent<any>