Package-level declarations

Types

Link copied to clipboard
external class Channel<StoreType, ContextType>

The class Channel represents an individual named channel within the data pipeline. It is used to track subscribers and to publish messages when there are subscribers present. It exists as a separate object to avoid channel lookups at publish time, enabling very fast publish speeds and allowing for heavy use while incurring very minimal cost. Channels are created with {@link channel}, constructing a channel directly with new Channel(name) is not supported.

Link copied to clipboard
typealias ChannelListener = (message: Any?, name: Any) -> Unit
Link copied to clipboard

The class TracingChannel is a collection of TracingChannel Channels which together express a single traceable action. It is used to formalize and simplify the process of producing events for tracing application flow. {@link tracingChannel} is used to construct a TracingChannel. As with Channel it is recommended to create and reuse a single TracingChannel at the top-level of the file rather than creating them dynamically.

Link copied to clipboard
sealed external interface TracingChannelCollection<StoreType, ContextType>
Link copied to clipboard
sealed external interface TracingChannelSubscribers<ContextType : Any>
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
external fun channel(name: Symbol): Channel<*, *>
external fun channel(name: String): Channel<*, *>

This is the primary entry-point for anyone wanting to publish to a named channel. It produces a channel object which is optimized to reduce overhead at publish time as much as possible.

Link copied to clipboard
external fun hasSubscribers(name: Symbol): Boolean
external fun hasSubscribers(name: String): Boolean

Check if there are active subscribers to the named channel. This is helpful if the message you want to send might be expensive to prepare.

Link copied to clipboard
external fun subscribe(name: Symbol, onMessage: ChannelListener)
external fun subscribe(name: String, onMessage: ChannelListener)

Register a message handler to subscribe to this channel. This message handler will be run synchronously whenever a message is published to the channel. Any errors thrown in the message handler will trigger an 'uncaughtException'.

Link copied to clipboard

Creates a TracingChannel wrapper for the given TracingChannel Channels. If a name is given, the corresponding tracing channels will be created in the form of tracing:${name}:${eventType} where eventType corresponds to the types of TracingChannel Channels.

Link copied to clipboard
external fun unsubscribe(name: Symbol, onMessage: ChannelListener): Boolean
external fun unsubscribe(name: String, onMessage: ChannelListener): Boolean

Remove a message handler previously registered to this channel with {@link subscribe}.