(detect-changes {:keys [watch-state cmp-id snapshot-publish-fn]})
Detect changes to the component state atom and then publish a snapshot using the 'snapshot-publish-fn'.
Detect changes to the component state atom and then publish a snapshot using the 'snapshot-publish-fn'.
(initial-cmp-map cmp-map cfg)
Assembles initial component map with core.async channels.
Assembles initial component map with core.async channels. - :put-chan is used in component's put-fn, not connected at first - :out-chan is the outgoing channel - :firehose-chan is for where all messages go (for debugging) - :sliding-out-chan is for state snapshots
(make-component {:keys [state-fn opts] :as cmp-map})
Creates a component with attached in-chan, out-chan, sliding-in-chan and sliding-out-chan. It takes the initial state atom, the handler function for messages on the in-chan, and the sliding-handler function, which handles messages on :sliding-in-chan. By default, in-chan and out-chan have standard buffers of size one, whereas sliding-in-chan and sliding-out-chan have sliding buffers of size one. The buffer sizes can be configured. The sliding-channels are meant for events where only ever the latest version is of interest, such as whenUI components rendering state snapshots from other components. Components send messages by using the put-fn, which is provided to the component when creating it's initial state, and then subsequently in every call to any of the handler functions. On every message send, a unique correlation ID is attached to every message. Also, messages are automatically assigned a tag, which is a unique ID that doesn't change when a message flows through the system. This tag can also be assigned manually by initially sending a message with the tag set on the metadata, as this tag will not be touched by the library whenever it exists already. The configuration of a component comes from merging the component defaults with the opts map that is passed on component creation the :opts key. The order of the merge operation allows overwriting the default settings. An observed-xform function can be provided, which transforms the observed state before resetting the respective observed state. This function takes a single argument, the observed state snapshot, and is expected to return a single map with the transformed snapshot.
Creates a component with attached in-chan, out-chan, sliding-in-chan and sliding-out-chan. It takes the initial state atom, the handler function for messages on the in-chan, and the sliding-handler function, which handles messages on :sliding-in-chan. By default, in-chan and out-chan have standard buffers of size one, whereas sliding-in-chan and sliding-out-chan have sliding buffers of size one. The buffer sizes can be configured. The sliding-channels are meant for events where only ever the latest version is of interest, such as whenUI components rendering state snapshots from other components. Components send messages by using the put-fn, which is provided to the component when creating it's initial state, and then subsequently in every call to any of the handler functions. On every message send, a unique correlation ID is attached to every message. Also, messages are automatically assigned a tag, which is a unique ID that doesn't change when a message flows through the system. This tag can also be assigned manually by initially sending a message with the tag set on the metadata, as this tag will not be touched by the library whenever it exists already. The configuration of a component comes from merging the component defaults with the opts map that is passed on component creation the :opts key. The order of the merge operation allows overwriting the default settings. An observed-xform function can be provided, which transforms the observed state before resetting the respective observed state. This function takes a single argument, the observed state snapshot, and is expected to return a single map with the transformed snapshot.
(make-snapshot-publish-fn {:keys [watch-state snapshot-xform-fn cmp-id
sliding-out-chan cfg firehose-chan]})
Creates a function for publishing changes to the component state atom as snapshot messages.
Creates a function for publishing changes to the component state atom as snapshot messages.
(make-system-ready-fn {:keys [put-chan out-chan snapshot-publish-fn]})
This function is called by the switchboard that wired this component when all other components are up and the channels between them connected. At this point, messages that were accumulated on the 'put-chan' buffer since startup are released. Also, the component state is published.
This function is called by the switchboard that wired this component when all other components are up and the channels between them connected. At this point, messages that were accumulated on the 'put-chan' buffer since startup are released. Also, the component state is published.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close