Liking cljdoc? Tell your friends :D

austinbirch.reactive-entity


clear-cache!cljs

(clear-cache!)

Empty the tracking state so that all ReactiveEntity attribute reads and ReactiveEntitySets must be re-read from the backing DataScript database.

Very useful in a live-reload workflow - set up your 'after JS load' hook to clear the cache, forcing entirely new reads and preventing any stale data from appearing during development.

Empty the tracking state so that all `ReactiveEntity` attribute
reads and `ReactiveEntitySet`s must be re-read from the backing
DataScript database.

Very useful in a live-reload workflow - set up your 'after JS
load' hook to clear the cache, forcing entirely new reads and
preventing any stale data from appearing during development.
sourceraw docstring

entitiescljs

(entities attr)

Returns a ReactiveEntitySet (sort of like a read-only Clojure set) that can be used in Reagent components, containing ReactiveEntitys for the passed attribute (attr).

The idea is that you would use in order to get access to ReactiveEntitys for all of the entities of a specific type, e.g. contacts via :contact/id, or todos via :todo/id.

If new entity ids are added to (or removed from) the DataScript database with the passed attr, then the component will be re-rendered and the ReactiveEntitySet will contain an up-to-date set of all the entities in the DataScript database for that attr.

attr must be marked :db.unique/identity in the DataScript schema.

Returns a `ReactiveEntitySet` (sort of like a read-only Clojure
set) that can be used in Reagent components, containing
`ReactiveEntity`s for the passed attribute (`attr`).

The idea is that you would use in order to get access to
`ReactiveEntity`s for all of the entities of a specific type,
e.g. contacts via `:contact/id`, or todos via `:todo/id`.

If new entity ids are added to (or removed from) the DataScript
database with the passed `attr`, then the component will be
re-rendered and the `ReactiveEntitySet` will contain an
up-to-date set of all the entities in the DataScript database
for that `attr`.


`attr` must be marked `:db.unique/identity` in the DataScript
schema.
sourceraw docstring

entitycljs

(entity eid)

Returns a ReactiveEntity (similar to a DataScript Entity) that can be used in Reagent components. All attribute accesses during render will be tracked, and then if those attributes are changed later the component will be re-rendered (ignoring changes to attributes that were not accessed by that component).

eid is either a DataScript entity id or a lookup ref.

Returns a ReactiveEntity (similar to a DataScript Entity) that
can be used in Reagent components. All attribute accesses during
render will be tracked, and then if those attributes are changed
later the component will be re-rendered (ignoring changes to
attributes that were not accessed by that component).

`eid` is either a DataScript entity id or a lookup ref.
sourceraw docstring

exists?cljs

(exists? entity)

Returns true if the entity exists in the DataScript database.

Useful in order to support creating reactive entities before the entities actually exist in the DataScript database - once they get added the component will re-render with the data.

Returns true if the entity exists in the DataScript database.

Useful in order to support creating reactive entities _before_
the entities actually exist in the DataScript database - once
they get added the component will re-render with the data.
sourceraw docstring

init!cljs

(init! conn)

Sets up tracking state on the given DataScript connection so that the reactive entity/entities can be used.

Sets up tracking state on the given DataScript connection so
that the reactive entity/entities can be used.
sourceraw docstring

is-reactive-entity?cljs

(is-reactive-entity? entity)

Returns true if entity is a ReactiveEntity

Returns true if `entity` is a `ReactiveEntity`
sourceraw docstring

snapshot-entity-as-mapcljs

(snapshot-entity-as-map entity)

Used for debugging only, non-reactive. Returns a map of the existing state of the reactive entity - kind of like what you would get if you called d/touch on a DataScript entity.

Useful for logging out the state of a reactive entity during a render pass, without having to subscribe to all changes on the entity.

Used for debugging only, non-reactive. Returns a map of the
existing state of the reactive entity - kind of like what you
would get if you called d/touch on a DataScript entity.

Useful for logging out the state of a reactive entity during
a render pass, without having to subscribe to all changes on
the entity.
sourceraw docstring

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

× close