Skip to content

API reference / @chanx-js/client / svelte / TopicStore

Interface: TopicStore<T> ​

Defined in: packages/client/src/svelte/index.ts:186

Extends ​

Type Parameters ​

Type Parameter
T extends TopicRef

Properties ​

clearMessages ​

ts
clearMessages: () => void;

Defined in: packages/client/src/svelte/index.ts:193

Returns ​

void


close ​

ts
close: () => void;

Defined in: packages/client/src/svelte/index.ts:194

Returns ​

void


getHandle ​

ts
getHandle: () => 
  | TopicHandle<ToServerOf<T>, ToClientOf<T>, RepliesOf<T>>
  | null;

Defined in: packages/client/src/svelte/index.ts:192

The topic's handle while joined.

Returns ​

| TopicHandle<ToServerOf<T>, ToClientOf<T>, RepliesOf<T>> | null


request ​

ts
request: RequestFn<ToServerOf<T>, RepliesOf<T>>;

Defined in: packages/client/src/svelte/index.ts:190

Send on the topic and wait for the reply carrying the same ref.


send ​

ts
send: (message) => void;

Defined in: packages/client/src/svelte/index.ts:188

Send on the topic.

Parameters ​

ParameterType
messageToServerOf<T>

Returns ​

void


terminate ​

ts
terminate: (code?, reason?) => void;

Defined in: packages/client/src/svelte/index.ts:196

Close the socket for every consumer sharing it.

Parameters ​

ParameterType
code?number
reason?string

Returns ​

void

Methods ​

subscribe() ​

ts
subscribe(
   this, 
   run, 
   invalidate?
): Unsubscriber;

Defined in: node_modules/.pnpm/svelte@5.57.1_@typescript-eslint+types@8.70.0/node_modules/svelte/types/index.d.ts:2769

Subscribe on value changes.

Parameters ​

ParameterTypeDescription
thisvoid-
runSubscriber<TopicSnapshot<T>>subscription callback
invalidate?() => voidcleanup callback

Returns ​

Unsubscriber

Inherited from ​

ts
Readable.subscribe

MIT licensed