Skip to content

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

Function: createTopic() ​

ts
function createTopic<D, T>(
   descriptor, 
   topic, 
   options?
): TopicStore<T>;

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

Join one topic as a store, typed from that topic throughout: createTopic(hub, hub.topics.roomTopic.with({ room_name: 'lobby' })). Same lifecycle as createChannel.

Type Parameters ​

Type Parameter
D extends ChannelDescriptor<any, any, any, any>
T extends TopicRef<ChanxMessage, ChanxMessage, string>

Parameters ​

ParameterType
descriptorD
topicT
optionsTopicControllerOptions<AddressOf<D>, T> & object

Returns ​

TopicStore<T>

MIT licensed