Functions

About 3 min

Functions

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

createDefaultModelFactory()

Returns: ModelFactory

Arguments: none

createDevtoolsRpcServer(client, clientServices)

Returns: Promise<void>

Arguments:

client: Client

clientServices: ClientServicesProvider

fromCliEnv([options])

Connects to locally running CLI daemon.

Returns: ClientServicesProvider

Arguments:

options: FromCliEnvOptions

fromHost([config])

Creates stand-alone services without rpc.

Returns: ClientServicesProvider

Arguments:

config: Config

fromIFrame([config], [options])

Create services provider proxy connected via iFrame to host.

Returns: ClientServicesProvider

Arguments:

config: Config

options: Omit<Partial<IFrameClientServicesProxyOptions>, "source">

fromSocket(url)

Access to remote client via a socket.

Returns: ClientServicesProvider

Arguments:

url: string

generateSeedPhrase()

Generate bip39 seed phrase (aka mnemonic).

Returns: string

Arguments: none

isReferenceLike(value)

Returns: value is object

Arguments:

value: any

isTypedObject(object)

Returns: object is TypedObject<Record<string, any>>

Arguments:

object: unknown

observer(baseComponent)

HOC to provide reactivity based on changes to ECHO state.

Returns: FunctionComponent<P>

Arguments:

baseComponent: FunctionComponent<P>

setStateFromSnapshot(obj, snapshot)

Returns: void

Arguments:

obj: EchoObject<any>

snapshot: ObjectSnapshot

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

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

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

useDevtools()open in new window

Returns: DevtoolsHost

Arguments: none

useHaloInvitation([invitationId])open in new window

Returns: InvitationStatus

Arguments:

invitationId: string

useHaloInvitations()open in new window

Returns: CancellableInvitationObservable[]

Arguments: none

useIdentity([options])open in new window

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

Returns: "null" | Identity

Arguments:

options: object

useInvitationStatus([initialObservable])open in new window

Returns: InvitationStatus

Arguments:

initialObservable: CancellableInvitationObservable

useKeyStore(defaultKeys)open in new window

Settings store.

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

Arguments:

defaultKeys: string[]

useMembers(spaceKey)open in new window

Returns: SpaceMember[]

Arguments:

spaceKey: undefined | PublicKey

useNetworkStatus()open in new window

Creates a network status subscription.

Returns: NetworkStatus

Arguments: none

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

Create subscription.

Returns: TypedObject[]

Arguments:

space: Space

filter: Filter<T>

options: QueryOptions

deps: any[]

useResultSet(resultSet)open in new window

A convenience hook used for subscribing to changing values of a result set. Result sets are reactive query results from ECHO.

Returns: T[]

Arguments:

resultSet: ResultSet<T>

useSpace([spaceKey])open in new window

Get a specific Space using its key. Returns undefined when no spaceKey is available. Requires a ClientProvider somewhere in the parent tree.

Returns: undefined | Space

Arguments:

spaceKey: PublicKeyLike

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

Returns: InvitationStatus

Arguments:

spaceKey: PublicKey

invitationId: string

useSpaceInvitations([spaceKey])open in new window

Returns: CancellableInvitationObservable[]

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

useStatus()open in new window

Returns: undefined | "null" | SystemStatus

Arguments: none

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

Subscribe to service API streams.

Returns: T

Arguments:

streamFactory: function

defaultValue: T

deps: DependencyList

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

wrapObservable(observable)

Testing util to wrap non-authenticating observable with promise. Don't use this in production code.

Returns: Promise<Invitation>

Arguments:

observable: CancellableInvitationObservable