Skip to main content

Functions


Functions

mountDevtoolsHooks(options)

Returns: void

Arguments:

options: MountOptions

unmountDevtoolsHooks()

Returns: void

Arguments: none

useDevtools()open in new window

Returns: DevtoolsHost

Arguments: none

useStream(streamFactory, defaultValue, deps)open in new window

Subscribe to service API streams.

Returns: T

Arguments:

streamFactory: function

defaultValue: T

deps: DependencyList

create(schema, obj, [meta])

Creates a reactive object from a plain Javascript object. Optionally provides a TS-effect schema.

Returns: ReactiveObject<T>

Arguments:

schema: Schema<T, any, never>

obj: ExcludeId<T>

meta: object

createDocAccessor(obj, path)

Returns: DocAccessor<T>

Arguments:

obj: EchoReactiveObject<T>

path: KeyPath

createEchoObject(init)

Returns: EchoReactiveObject<T>

Arguments:

init: T

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(accessor, cursor)

Returns: number

Arguments:

accessor: DocAccessor<any>

cursor: string

fullyQualifiedId(object)

Fully qualified id of a reactive object is a combination of the space id and the object id.

Returns: string

Arguments:

object: ReactiveObject<any>

getMeta(obj)

Returns: object

Arguments:

obj: T

getObjectCore(obj)

Returns: ObjectCore

Arguments:

obj: EchoReactiveObject<T>

getRangeFromCursor(accessor, cursor)

Returns: undefined | object

Arguments:

accessor: DocAccessor<any>

cursor: string

getSchema(obj)

Returns the schema for the given object if one is defined.

Returns: undefined | Schema<any, any, never>

Arguments:

obj: undefined | T

getSpace([object])

Returns: undefined | Space

Arguments:

object: ReactiveObject<any>

getTextInRange(accessor, start, end)

Returns: string

Arguments:

accessor: DocAccessor<any>

start: string

end: string

getType(obj)

Returns: undefined | Reference

Arguments:

obj: undefined | T

getTypename(obj)

Returns: undefined | string

Arguments:

obj: T

hasType(type)

Returns: function

Arguments:

type: function

internalDecodeReference(value)

Returns: Reference

Arguments:

value: any

isEchoObject(value)

Returns: value is EchoReactiveObject<any>

Arguments:

value: unknown

isSpace(object)

Returns: object is Space

Arguments:

object: unknown

loadObjectReferences(objOrArray, valueAccessor, [timeout])

EXPERIMENTAL - the API is subject to change.

Returns: Promise<[object Object] extends [object Object] ? [object Object] : [object Object]>

Arguments:

objOrArray: T | T[]

valueAccessor: function

timeout: object

toCursor(accessor, pos, [assoc])

Returns: string

Arguments:

accessor: DocAccessor<any>

pos: number

assoc: number

toCursorRange(accessor, start, end)

Returns: string

Arguments:

accessor: DocAccessor<any>

start: number

end: number

useMembers(spaceKey)open in new window

Returns: SpaceMember[]

Arguments:

spaceKey: undefined | PublicKey

useQuery([spaceOrEcho], [filter], [options], [deps])open in new window

Create subscription.

Returns: T[]

Arguments:

spaceOrEcho: Space | Echo

filter: FilterSource<T>

options: QueryOptions

deps: any[]

useSpace([spaceKeyLike])open in new window

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:

spaceKeyLike: PublicKeyLike

useSpaceInvitation([spaceKey], [invitationId])open in new window

Returns: InvitationStatus

Arguments:

spaceKey: PublicKey

invitationId: string

useSpaceInvitations([spaceKey])open in new window

Returns: CancellableInvitation[]

Arguments:

spaceKey: PublicKey

useSpaces(options)open in new window

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)open in new window

Create reactive selection. Calls the callback when the selection changes and during the first render.

Returns: undefined | SubscriptionHandle

Arguments:

cb: function

selection: Selection

useContacts()open in new window

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()open in new window

Returns: Device[]

Arguments: none

useHaloInvitation([invitationId])open in new window

Returns: InvitationStatus

Arguments:

invitationId: string

useHaloInvitations()open in new window

Returns: CancellableInvitation[]

Arguments: none

useIdentity()open in new window

Hook returning DXOS identity object. Requires ClientContext to be set via ClientProvider.

Returns: "null" | Identity

Arguments: none

useKeyStore(defaultKeys)open in new window

Settings store.

Returns: [Map<string, string>, function]

Arguments:

defaultKeys: string[]

AgentHostingProvider(props)open in new window

Experimental agent hosting provider.

Returns: Element

Arguments:

props: object

ClientProvider(options)open in new window

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, [authenticationToken])

Returns: Partial<Config>

Arguments:

target: undefined | string

authenticationToken: string

Storage()

Load config from storage.

Returns: Promise<Partial<Config>>

Arguments: none

createClientServices(config, [createWorker], [observabilityGroup], [signalTelemetryEnabled])

Create services from config.

Returns: Promise<ClientServicesProvider>

Arguments:

config: Config

createWorker: function

observabilityGroup: string

signalTelemetryEnabled: boolean

fromAgent([options])

Connects to locally running CLI daemon.

Returns: ClientServicesProvider

Arguments:

options: FromAgentOptions

fromHost([config], [params], [observabilityGroup], [signalTelemetryEnabled])

Creates stand-alone services without rpc.

Returns: Promise<ClientServicesProvider>

Arguments:

config: Config

params: ClientServicesHostParams

observabilityGroup: string

signalTelemetryEnabled: boolean

fromSocket(url, [authenticationToken])

Access to remote client via a socket.

Returns: Promise<ClientServicesProvider>

Arguments:

url: string

authenticationToken: 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

useAgentHostingClient()open in new window

Returns: "null" | AgentHostingProviderClient

Arguments: none

useClient()open in new window

Hook returning instance of DXOS client. Requires ClientContext to be set via ClientProvider.

Returns: Client

Arguments: none

useClientServices()open in new window

Returns: undefined | ClientServices

Arguments: none

useClientStatus(client)open in new window

Returns: undefined | "null" | SystemStatus

Arguments:

client: Client

useConfig()open in new window

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()open in new window

Helper hook to access the shell.

Returns: Shell

Arguments: none

useShellDisplay()open in new window

Hook to access the shell’s display state.

Returns: ShellDisplay

Arguments: none

useStatus()open in new window

Returns: undefined | "null" | SystemStatus

Arguments: none

useInvitationStatus([observable])open in new window

Returns: InvitationStatus

Arguments:

observable: CancellableInvitation

useNetworkStatus()open in new window

Creates a network status subscription.

Returns: NetworkStatus

Arguments: none

getWorkerServiceHost()

Returns: Promise<ClientServicesHost>

Arguments: none

onconnect(event)

Returns: Promise<void>

Arguments:

event: MessageEvent<any>