Functions
Functions
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
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()
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
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
useDevtools()
Returns: DevtoolsHost
Arguments: none
useHaloInvitation([invitationId])
Returns: InvitationStatus
Arguments:
invitationId
: string
useHaloInvitations()
Returns: CancellableInvitationObservable[]
Arguments: none
useIdentity([options])
Hook returning DXOS identity object. Requires ClientContext to be set via ClientProvider.
Returns: "null" | Identity
Arguments:
options
: object
useInvitationStatus([initialObservable])
Returns: InvitationStatus
Arguments:
initialObservable
: CancellableInvitationObservable
useKeyStore(defaultKeys)
Settings store.
Returns: [Map<string, string>, function]
Arguments:
defaultKeys
: string[]
useMembers(spaceKey)
Returns: SpaceMember[]
Arguments:
spaceKey
: undefined | PublicKey
useNetworkStatus()
Creates a network status subscription.
Returns: NetworkStatus
Arguments: none
useQuery([space], [filter], [options], [deps])
Create subscription.
Returns: TypedObject[]
Arguments:
space
: Space
filter
: Filter<T>
options
: QueryOptions
deps
: any[]
useResultSet(resultSet)
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])
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])
Returns: InvitationStatus
Arguments:
spaceKey
: PublicKey
invitationId
: string
useSpaceInvitations([spaceKey])
Returns: CancellableInvitationObservable[]
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
useStatus()
Returns: undefined | "null" | SystemStatus
Arguments: none
useStream(streamFactory, defaultValue, deps)
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