(add-root! reconciler root-class target)
(add-root! reconciler root-class target options)
Given a root component class and a target root DOM node, instantiate and render the root class using the reconciler's :state property. The reconciler will continue to observe changes to :state and keep the target node in sync. Note a reconciler may have only one root. If invoked on a reconciler with an existing root, the new root will replace the old one.
Given a root component class and a target root DOM node, instantiate and render the root class using the reconciler's :state property. The reconciler will continue to observe changes to :state and keep the target node in sync. Note a reconciler may have only one root. If invoked on a reconciler with an existing root, the new root will replace the old one.
(annotate-mutations tx ident)
Given a query expression annotate all mutations by adding a :mutator -> ident entry to the metadata of each mutation expression in the query.
Given a query expression annotate all mutations by adding a :mutator -> ident entry to the metadata of each mutation expression in the query.
(app-root reconciler)
Return the application's root component.
Return the application's root component.
(app-state reconciler)
Return the reconciler's application state atom. Useful when the reconciler was initialized via denormalized data.
Return the reconciler's application state atom. Useful when the reconciler was initialized via denormalized data.
(children component)
Returns the component's children.
Returns the component's children.
(class->any x class)
Get any component from the indexer that matches the component class.
Get any component from the indexer that matches the component class.
(class-path c)
Return the component class path associated with a component.
Return the component class path associated with a component.
(class-path->queries x y)
Given x (a reconciler or indexer) and y (a component or component class path), return the queries for that path.
Given x (a reconciler or indexer) and y (a component or component class path), return the queries for that path.
(component? x)
Returns true if the argument is an Om component.
Returns true if the argument is an Om component.
(computed props computed-map)
Add computed properties to props. Note will replace any pre-existing computed properties.
Add computed properties to props. Note will replace any pre-existing computed properties.
(db->tree query data refs)
(db->tree query data refs map-ident)
Given a query, some data in the default database format, and the entire application state in the default database format, return the tree where all ident links have been replaced with their original node values.
Given a query, some data in the default database format, and the entire application state in the default database format, return the tree where all ident links have been replaced with their original node values.
(default-migrate app-state-pure query tempids)
(default-migrate app-state-pure query tempids id-key)
Given app-state-pure (the application state as an immutable value), a query, tempids (a hash map from tempid to stable id), and an optional id-key keyword, return a new application state value with the tempids replaced by the stable ids.
Given app-state-pure (the application state as an immutable value), a query, tempids (a hash map from tempid to stable id), and an optional id-key keyword, return a new application state value with the tempids replaced by the stable ids.
(depth component)
PRIVATE: Returns the render depth (a integer) of the component relative to the mount root.
PRIVATE: Returns the render depth (a integer) of the component relative to the mount root.
(dispatch _ key _)
Helper function for implementing :read and :mutate as multimethods. Use this as the dispatch-fn.
Helper function for implementing :read and :mutate as multimethods. Use this as the dispatch-fn.
(factory class)
(factory class
{:keys [validator keyfn instrument?] :or {instrument? true} :as opts})
Create a factory constructor from a component class created with om.next/defui.
Create a factory constructor from a component class created with om.next/defui.
(focus-query query path)
Given a query, focus it along the specified path.
Examples: (om.next/focus-query [:foo :bar :baz] [:foo]) => [:foo]
(om.next/focus-query [{:foo [:bar :baz]} :woz] [:foo :bar]) => [{:foo [:bar]}]
Given a query, focus it along the specified path. Examples: (om.next/focus-query [:foo :bar :baz] [:foo]) => [:foo] (om.next/focus-query [{:foo [:bar :baz]} :woz] [:foo :bar]) => [{:foo [:bar]}]
(force expr)
(force expr target)
Given a query expression return an equivalent query expression that can be spliced into a transaction that will force a read of that key from the specified remote target.
Given a query expression return an equivalent query expression that can be spliced into a transaction that will force a read of that key from the specified remote target.
(force-root-render! reconciler)
Force a re-render of the root. Not recommended for anything except recomputing :shared.
Force a re-render of the root. Not recommended for anything except recomputing :shared.
(from-history reconciler uuid)
Given a reconciler and UUID return the application state snapshost from history associated with the UUID. The size of the reconciler history may be configured by the :history option when constructing the reconciler.
Given a reconciler and UUID return the application state snapshost from history associated with the UUID. The size of the reconciler history may be configured by the :history option when constructing the reconciler.
(full-query component)
(full-query component query)
Returns the absolute query for a given component, not relative like om.next/get-query.
Returns the absolute query for a given component, not relative like om.next/get-query.
(gather-sends {:keys [parser] :as env} q remotes)
Given an environment, a query and a set of remotes return a hash map of remotes mapped to the query specific to that remote.
Given an environment, a query and a set of remotes return a hash map of remotes mapped to the query specific to that remote.
(get-computed x)
(get-computed x k-or-ks)
Return the computed properties on a component or its props.
Return the computed properties on a component or its props.
(get-ident x)
Given a mounted component with assigned props, return the ident for the component.
Given a mounted component with assigned props, return the ident for the component.
(get-indexer reconciler)
PRIVATE: Get the indexer associated with the reconciler.
PRIVATE: Get the indexer associated with the reconciler.
(get-params component)
Return the query params for a component.
Return the query params for a component.
(get-query x)
Return a IQuery/IParams instance bound query. Works for component classes and component instances. See also om.next/full-query.
Return a IQuery/IParams instance bound query. Works for component classes and component instances. See also om.next/full-query.
(get-rendered-state component)
(get-rendered-state component k-or-ks)
Get the rendered state of component. om.next/get-state always returns the up-to-date state.
Get the rendered state of component. om.next/get-state always returns the up-to-date state.
(get-state component)
(get-state component k-or-ks)
Get a component's local state. May provide a single key or a sequential collection of keys for indexed access into the component's local state.
Get a component's local state. May provide a single key or a sequential collection of keys for indexed access into the component's local state.
(get-unbound-query component)
Return the unbound query for a component.
Return the unbound query for a component.
(ident this props)
Return the ident for this component
Return the ident for this component
(-get-rendered-state this)
Get the component's rendered local state
Get the component's rendered local state
(-get-state this)
Get the component's local state
Get the component's local state
(-merge-pending-state! this)
Get the component's pending local state
Get the component's pending local state
(-set-state! this new-state)
Set the component's local state
Set the component's local state
(indexer)
(indexer extfs)
Given a function (Component -> Ref), return an indexer.
Given a function (Component -> Ref), return an indexer.
(query this)
Return the component's unbound query
Return the component's unbound query
(params this)
Return the query parameters
Return the query parameters
(tx-intercept c tx)
An optional protocol that component may implement to intercept child transactions.
An optional protocol that component may implement to intercept child transactions.
(merge! reconciler delta)
(merge! reconciler delta query)
(merge! reconciler delta query remote)
Merge a state delta into the application state. Affected components managed by the reconciler will re-render.
Merge a state delta into the application state. Affected components managed by the reconciler will re-render.
(mounted? x)
Returns true if the component is mounted.
Returns true if the component is mounted.
(parser {:keys [read mutate] :as opts})
Create a parser. The argument is a map of two keys, :read and :mutate. Both functions should have the signature (Env -> Key -> Params -> ParseResult).
Create a parser. The argument is a map of two keys, :read and :mutate. Both functions should have the signature (Env -> Key -> Params -> ParseResult).
(props component)
Return a components props.
Return a components props.
(query->ast query-expr)
Given a query expression convert it into an AST.
Given a query expression convert it into an AST.
(react-key component)
Returns the components React key.
Returns the components React key.
(react-ref component name)
Returns the component associated with a component's React ref.
Returns the component associated with a component's React ref.
(react-set-state! component new-state)
(react-set-state! component new-state cb)
(react-type component)
(react-type x)
Returns the component type, regardless of whether the component has been mounted
Returns the component type, regardless of whether the component has been mounted
(reader)
(reader opts)
Create a Om Next transit reader. This reader can handler the tempid type. Can pass transit reader customization opts map.
Create a Om Next transit reader. This reader can handler the tempid type. Can pass transit reader customization opts map.
(reconciler
{:keys [state shared shared-fn parser indexer ui->props normalize send
merge-sends remotes merge merge-tree merge-ident prune-tree optimize
history root-render root-unmount pathopt migrate id-key instrument
tx-listen easy-reads]
:or {root-render (fn [c target] c)
prune-tree default-extract-errors
pathopt false
merge-sends (fn* [p1__3241# p2__3242#]
(merge-with into p1__3241# p2__3242#))
merge-ident default-merge-ident
remotes [:remote]
migrate default-migrate
easy-reads true
history 100
merge default-merge
ui->props default-ui->props
indexer om.next/indexer
root-unmount (fn [x])
merge-tree default-merge-tree
optimize (fn [cs] (sort-by depth cs))}
:as config})
(reconciler
{:keys [state shared shared-fn parser indexer ui->props normalize send
merge-sends remotes merge merge-tree merge-ident prune-tree optimize
history root-render root-unmount pathopt migrate id-key instrument
tx-listen easy-reads]
:or {root-render (fn* [p1__4007# p2__4008#]
(js/ReactDOM.render p1__4007# p2__4008#))
prune-tree default-extract-errors
pathopt false
merge-sends (fn* [p1__4005# p2__4006#]
(merge-with into p1__4005# p2__4006#))
merge-ident default-merge-ident
remotes [:remote]
migrate default-migrate
easy-reads true
history 100
merge default-merge
ui->props default-ui->props
indexer om.next/indexer
root-unmount (fn* [p1__4009#]
(js/ReactDOM.unmountComponentAtNode p1__4009#))
merge-tree default-merge-tree
optimize (fn [cs] (sort-by depth cs))}
:as config})
Construct a reconciler from a configuration map.
Required parameters: :state - the application state. If IAtom value is not supplied the data will be normalized into the default database format using the root query. This can be disabled by explicitly setting the optional :normalize parameter to false. :parser - the parser to be used
Optional parameters: :shared - a map of global shared properties for the component tree. :shared-fn - a function to compute global shared properties from the root props. the result is merged with :shared. :send - required only if the parser will return a non-empty value when run against the supplied :remotes. send is a function of two arguments, the map of remote expressions keyed by remote target and a callback which should be invoked with the result from each remote target. Note this means the callback can be invoked multiple times to support parallel fetching and incremental loading if desired. The callback should take the response as the first argument and the the query that was sent as the second argument. :normalize - whether the state should be normalized. If true it is assumed all novelty introduced into the system will also need normalization. :remotes - a vector of keywords representing remote services which can evaluate query expressions. Defaults to [:remote] :root-render - the root render function. Defaults to ReactDOM.render :root-unmount - the root unmount function. Defaults to ReactDOM.unmountComponentAtNode :logger - supply a goog.log compatible logger :tx-listen - a function of 2 arguments that will listen to transactions. The first argument is the parser's env map also containing the old and new state. The second argument is a map containing the transaction, its result and the remote sends that the transaction originated.
Construct a reconciler from a configuration map. Required parameters: :state - the application state. If IAtom value is not supplied the data will be normalized into the default database format using the root query. This can be disabled by explicitly setting the optional :normalize parameter to false. :parser - the parser to be used Optional parameters: :shared - a map of global shared properties for the component tree. :shared-fn - a function to compute global shared properties from the root props. the result is merged with :shared. :send - required only if the parser will return a non-empty value when run against the supplied :remotes. send is a function of two arguments, the map of remote expressions keyed by remote target and a callback which should be invoked with the result from each remote target. Note this means the callback can be invoked multiple times to support parallel fetching and incremental loading if desired. The callback should take the response as the first argument and the the query that was sent as the second argument. :normalize - whether the state should be normalized. If true it is assumed all novelty introduced into the system will also need normalization. :remotes - a vector of keywords representing remote services which can evaluate query expressions. Defaults to [:remote] :root-render - the root render function. Defaults to ReactDOM.render :root-unmount - the root unmount function. Defaults to ReactDOM.unmountComponentAtNode :logger - supply a goog.log compatible logger :tx-listen - a function of 2 arguments that will listen to transactions. The first argument is the parser's env map also containing the old and new state. The second argument is a map containing the transaction, its result and the remote sends that the transaction originated.
(reconciler? x)
Returns true if x is a reconciler.
Returns true if x is a reconciler.
(reduce-query-depth q k)
Changes a join on key k with depth limit from [:a {:k n}] to [:a {:k (dec n)}]
Changes a join on key k with depth limit from [:a {:k n}] to [:a {:k (dec n)}]
(ref->any x ref)
Get any component from the indexer that matches the ref.
Get any component from the indexer that matches the ref.
(ref->components x ref)
Return all components for a given ref.
Return all components for a given ref.
(remove-root! reconciler target)
Remove a root target (a DOM element) from a reconciler. The reconciler will no longer attempt to reconcile application state with the specified root.
Remove a root target (a DOM element) from a reconciler. The reconciler will no longer attempt to reconcile application state with the specified root.
(set-query! x params&query)
(set-query! x {:keys [params query]} reads)
Change the query of a component. Takes a map containing :params and/or :query. :params should be a map of new bindings and :query should be a query expression. Will schedule a re-render as well as remote re-sends if necessary.
Change the query of a component. Takes a map containing :params and/or :query. :params should be a map of new bindings and :query should be a query expression. Will schedule a re-render as well as remote re-sends if necessary.
(set-state! component new-state)
Set the component local state of the component. Analogous to React's setState.
Set the component local state of the component. Analogous to React's setState.
(shared component)
(shared component k-or-ks)
Return the global shared properties of the Om Next root. See :shared and :shared-fn reconciler options.
Return the global shared properties of the Om Next root. See :shared and :shared-fn reconciler options.
(subquery x subquery-ref subquery-class)
Given a class or mounted component x and a ref to an instantiated component or class that defines a subquery, pick the most specific subquery. If the component is mounted subquery-ref will be used, subquery-class otherwise.
Given a class or mounted component x and a ref to an instantiated component or class that defines a subquery, pick the most specific subquery. If the component is mounted subquery-ref will be used, subquery-class otherwise.
(tempid? x)
Return true if x is a tempid, false otherwise
Return true if x is a tempid, false otherwise
(transact! x tx)
(transact! r ref tx)
Given a reconciler or component run a transaction. tx is a parse expression that should include mutations followed by any necessary read. The reads will be used to trigger component re-rendering.
Example:
(om/transact! widget '[(do/this!) (do/that!) :read/this :read/that])
Given a reconciler or component run a transaction. tx is a parse expression that should include mutations followed by any necessary read. The reads will be used to trigger component re-rendering. Example: (om/transact! widget '[(do/this!) (do/that!) :read/this :read/that])
(transform-reads r tx)
Given r (a reconciler) and a query expression including a mutation and any simple reads, return the equivalent query expression where the simple reads have been replaced by the full query for each component that cares about the specified read.
Given r (a reconciler) and a query expression including a mutation and any simple reads, return the equivalent query expression where the simple reads have been replaced by the full query for each component that cares about the specified read.
(tree->db x data)
(tree->db x data merge-idents)
Given a Om component class or instance and a tree of data, use the component's query to transform the tree into the default database format. All nodes that can be mapped via Ident implementations wil be replaced with ident links. The original node data will be moved into tables indexed by ident. If merge-idents option is true, will return these tables in the result instead of as metadata.
Given a Om component class or instance and a tree of data, use the component's query to transform the tree into the default database format. All nodes that can be mapped via Ident implementations wil be replaced with ident links. The original node data will be moved into tables indexed by ident. If merge-idents option is true, will return these tables in the result instead of as metadata.
(update-query! component f)
(update-query! component f arg0)
(update-query! component f arg0 arg1)
(update-query! component f arg0 arg1 arg2)
(update-query! component f arg0 arg1 arg2 arg3 & arg-rest)
Update a component's query and query parameters with a function.
Update a component's query and query parameters with a function.
(update-state! component f)
(update-state! component f arg0)
(update-state! component f arg0 arg1)
(update-state! component f arg0 arg1 arg2)
(update-state! component f arg0 arg1 arg2 arg3)
(update-state! component f arg0 arg1 arg2 arg3 & arg-rest)
Update a component's local state. Similar to Clojure(Script)'s swap!
Update a component's local state. Similar to Clojure(Script)'s swap!
(writer)
(writer opts)
Create a Om Next transit writer. This writer can handler the tempid type. Can pass transit writer customization opts map.
Create a Om Next transit writer. This writer can handler the tempid type. Can pass transit writer customization opts map.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close