Protocols for extending hyper's capabilities.
Consumers implementing external state sources (databases, message queues, etc.)
should extend the Watchable protocol to enable reactive re-renders via h/watch!.
Protocols for extending hyper's capabilities. Consumers implementing external state sources (databases, message queues, etc.) should extend the Watchable protocol to enable reactive re-renders via `h/watch!`.
Protocol for types that can be watched for changes.
Extend this to allow watch! to observe custom external state sources
like databases, message queues, or any stateful resource.
Implementations must:
Protocol for types that can be watched for changes. Extend this to allow `watch!` to observe custom external state sources like databases, message queues, or any stateful resource. Implementations must: - Call (callback old-val new-val) when the watched value changes - Support multiple concurrent watches keyed by unique keys - Remove the watch cleanly when -remove-watch is called - Implement -dispose to release underlying resources (connections, subscriptions, file handles, etc.) when the tab navigates away or disconnects. Return nil. For simple sources like atoms that hold no external resources, -dispose should be a no-op.
(-add-watch this key callback)Add a watch with the given key. callback is (fn [old-val new-val]).
Add a watch with the given key. callback is (fn [old-val new-val]).
(-dispose this)Release any resources held by this source. Called when the tab navigates away or disconnects, after all watches have been removed. No-op for sources that hold no external resources.
Release any resources held by this source. Called when the tab navigates away or disconnects, after all watches have been removed. No-op for sources that hold no external resources.
(-remove-watch this key)Remove a previously added watch by key.
Remove a previously added watch by key.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |