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 Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
M extends MessageMap |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name | string |
options? | ChannelOptions<M> |
Returns
Section titled “Returns”ChannelHooks<M>