Types
Type Aliases
Section titled “Type Aliases”Capable
Section titled “Capable”Guide: TypeScript
type Capable<TModules, Ctx> = | CapableBase<Ctx> | InferRevivables<TModules, Ctx> | { [key: string]: Capable<TModules, Ctx> } | ReadonlyArray<Capable<TModules, Ctx>> | Map<Capable<TModules, Ctx>, Capable<TModules, Ctx>> | Set<Capable<TModules, Ctx>>Defined in: types.ts:70
Type Parameters
Section titled “Type Parameters”TModules
Section titled “TModules”TModules extends readonly RevivableModule[] = DefaultRevivableModules
Ctx extends RevivableContext = RevivableContext
Jsonable
Section titled “Jsonable”Guide: TypeScript
type Jsonable = | boolean | null | number | string | { [key: string]: Jsonable } | ReadonlyArray<Jsonable>Defined in: types.ts:16
Message
Section titled “Message”type Message<TModules> = MessageBase & MessageVariant<TModules>Defined in: types.ts:131
Type Parameters
Section titled “Type Parameters”TModules
Section titled “TModules”TModules extends readonly RevivableModule[] = DefaultRevivableModules
MessageBase
Section titled “MessageBase”type MessageBase = { __OSRA_KEY__: string name?: string uuid: Uuid}Defined in: types.ts:113
Properties
Section titled “Properties”__OSRA_KEY__
Section titled “__OSRA_KEY__”__OSRA_KEY__: stringDefined in: types.ts:114
optional name?: string;Defined in: types.ts:117
uuid: UuidDefined in: types.ts:116
UUID of the client that sent the message
MessageEventMap
Section titled “MessageEventMap”type MessageEventMap<TModules> = { message: CustomEvent<Message<TModules>>}Defined in: types.ts:137
Type Parameters
Section titled “Type Parameters”TModules
Section titled “TModules”TModules extends readonly RevivableModule[] = DefaultRevivableModules
Properties
Section titled “Properties”message
Section titled “message”message: CustomEvent<Message<TModules>>Defined in: types.ts:140
MessageEventTarget
Section titled “MessageEventTarget”type MessageEventTarget<TModules> = TypedEventTarget<MessageEventMap<TModules>>Defined in: types.ts:143
Type Parameters
Section titled “Type Parameters”TModules
Section titled “TModules”TModules extends readonly RevivableModule[] = DefaultRevivableModules
MessageFields
Section titled “MessageFields”type MessageFields = { remoteUuid: Uuid type: string}Defined in: types.ts:108
Properties
Section titled “Properties”remoteUuid
Section titled “remoteUuid”remoteUuid: UuidDefined in: types.ts:110
type: stringDefined in: types.ts:109
MessageVariant
Section titled “MessageVariant”type MessageVariant<TModules> = ProtocolMessage | ConnectionMessage<TModules> | InferMessages<TModules>Defined in: types.ts:124
Type Parameters
Section titled “Type Parameters”TModules
Section titled “TModules”TModules extends readonly RevivableModule[] = DefaultRevivableModules
ProtocolMessage
Section titled “ProtocolMessage”type ProtocolMessage = | { remoteUuid?: Uuid type: 'announce' } | { remoteUuid: Uuid type: 'close' }Defined in: types.ts:120
Remote
Section titled “Remote”Guide: TypeScript
type Remote<T> = T extends (...args: infer P) => infer R ? (...args: P) => Promise<Remote<Awaited<R>>> : T extends Promise<infer U> ? Promise<Remote<U>> : T extends Map<infer K, infer V> ? Map<Remote<K>, Remote<V>> : T extends Set<infer V> ? Set<Remote<V>> : T extends ReadableStream<infer C> ? ReadableStream<Remote<C>> : T extends | Date | Error | RegExp | ArrayBuffer | ArrayBufferView | Blob | File | FileList | WritableStream | MessagePort | AbortSignal | Request | Response | Headers ? T : T extends EventTarget ? EventTarget : T extends AsyncIterable<infer U> ? AsyncIterableIterator<Remote<U>> : T extends ReadonlyArray<unknown> ? { [K in keyof (...)]: Remote<(...)> } : T extends object ? { [K in (...)]: (...) } : T;Defined in: types.ts:84
What a value looks like from the far side of the connection: functions become async (calls cross the wire), containers map recursively, everything else revives as itself.
Type Parameters
Section titled “Type Parameters”T
Structurable
Section titled “Structurable”Guide: TypeScript
type Structurable = | Jsonable | void | undefined | bigint | Date | RegExp | Blob | File | FileList | ArrayBuffer | ArrayBufferView | ImageBitmap | ImageData | { [key: string]: Structurable } | ReadonlyArray<Structurable> | Map<Structurable, Structurable> | Set<Structurable>Defined in: types.ts:24
StructurableTransferable
Section titled “StructurableTransferable”Guide: TypeScript
type StructurableTransferable = | Structurable | NonAbsorbing<Transferable> | { [key: string]: StructurableTransferable } | ReadonlyArray<StructurableTransferable> | Map<StructurableTransferable, StructurableTransferable> | Set<StructurableTransferable>Defined in: types.ts:53
type Uuid = `${string}-${string}-${string}-${string}-${string}`Defined in: types.ts:13
Variables
Section titled “Variables”OSRA_BOX
Section titled “OSRA_BOX”Guide: Low-level API
const OSRA_BOX: '__OSRA_BOX__'Defined in: types.ts:11
OSRA_DEFAULT_KEY
Section titled “OSRA_DEFAULT_KEY”Guide: Low-level API
const OSRA_DEFAULT_KEY: '__OSRA_DEFAULT_KEY__'Defined in: types.ts:10
OSRA_KEY
Section titled “OSRA_KEY”Guide: Low-level API
const OSRA_KEY: '__OSRA_KEY__'Defined in: types.ts:9