Rxova
Skip to content

defineChannel

function defineChannel<M>(name, options?): ChannelHooks<M>;

Bind a channel name and message map once, at module level, and get fully typed hooks back. Sugar over useChannel/useMessage/useSend — the same page-wide channel singleton is shared, so mixing bound and standalone hooks for one name is safe.

Options are registered here and applied when the channel is first needed, so declaring a schema at module scope still constructs nothing on import.

Type Parameter
M extends MessageMap
ParameterType
namestring
options?ChannelOptions<M>

ChannelHooks<M>