Liking cljdoc? Tell your friends :D
ClojureScript only.

entanglement.core


cursorcljs

(cursor a path)

Create a cursor. Behaves like a normal atom for the value at the specified path.

Create a cursor. Behaves like a normal atom for the value at the
specified path.
sourceraw docstring

entanglecljs

(entangle source-atom getter)
(entangle source-atom
          getter
          setter
          &
          {:keys [meta validator derefer identifier]})

Return an atom which applies custom getter and setter to the source-atom for every lookup/update/watches.

getter: (fn [derefed-source-atom] ...) setter [optional]: (fn [derefed-source-atom new-value]...)

derefer [optional]: (fn [this(new-atom) source-atom getter] ....)

identifier [optional]: :some-id -- more info below

When creating delicate entanglement (when the datastructure between the source atom and the new atom are quite different), it is suggested to provide a validator function.

The validator and meta arguments act the same way as for normal atoms.

A 'read-only' atom can be created simply by omitting or passing nil as the setter argument. Any attempt to modify directly the returned atom will result in an error.

Because we can't test for equality between functions (getter and setter), basic entangled atoms can't test for equality. This is especially important when adding watches, as they need to test for equality for potential duplicates. To avoid this problem, it's possible to provide a 'identifier' field which contains the object on which the equality should be tested.

Return an atom which applies custom getter and setter to the
source-atom for every lookup/update/watches.

getter:              (fn [derefed-source-atom] ...)
setter [optional]:   (fn [derefed-source-atom new-value]...)

derefer [optional]:  (fn [this(new-atom) source-atom getter] ....)

identifier [optional]: :some-id -- more info below

When creating delicate entanglement (when the datastructure between
the source atom and the new atom are quite different), it is
suggested to provide a validator function.

The validator and meta arguments act the same way as for normal
atoms.

A 'read-only' atom can be created simply by omitting or passing nil
as the setter argument. Any attempt to modify directly the returned
atom will result in an error.

Because we can't test for equality between functions (getter and
setter), basic entangled atoms can't test for equality. This is
especially important when adding watches, as they need to test for
equality for potential duplicates. To avoid this problem, it's
possible to provide a 'identifier' field which contains the object
on which the equality should be tested.
sourceraw docstring

Entangledcljs

source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close