A faster Atom and DerivedAtom impl for clojurescript.
{:deps {funcool/okulary {:mvn/version "2022.04.07-12"}}}
Is a Faster (mainly related to watcher handling) implementation of Atom reference type (of clojurescript).
(require '[okulary.core :as ol])
(def myatom (ol/atom 0))
@myatom
;; => 0
It behaves almost identically to the default builtin atom. Just dispatches the watchers much faster. being faster don't mean better than the default one. The implementation of this library has tradeoffs:
The main use case for this implementation is for situations where you have a huge amount of watchers and you want watcher dispatching very fast.
The DerivedAtom is like a read-only cursor, and can derive from the atom defined in this library or any that implements the IWatchable protocol (clojurescript builtin Atom as example).
(def a1 (ol/atom {:a 1 :b 1}))
(def d1 (ol/derived :a a1))
@a1
;; => {:a 1 :b 1}
@d1
;; => 1
The relevant features of DerivedAtom's:
identical?
equality check (you can provide your
own equality function as third argument to derived
).Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close