Liking cljdoc? Tell your friends :D

om.core


_refscljs

source

adaptcljs

(adapt x other)
source

add-ref-to-component!cljs

(add-ref-to-component! c ref)
source

buildcljs

(build f x)
(build f x m)

Builds an Om component. Takes an IRender/IRenderState instance returning function f, a value, and an optional third argument which may be a map of build specifications.

f - is a function of 2 or 3 arguments. The first argument can be any value and the second argument will be the owning pure node. If a map of options m is passed in this will be the third argument. f must return at a minimum an IRender or IRenderState instance, this instance may implement other React life cycle protocols.

x - any value

m - a map the following keys are allowed:

:key - a keyword that should be used to look up the key used by React itself when rendering sequential things. :react-key - an explicit react key :fn - a function to apply to the data before invoking f. :init-state - a map of initial state to pass to the component. :state - a map of state to pass to the component, will be merged in. :opts - a map of values. Can be used to pass side information down the render tree. :descriptor - a JS object of React methods, will be used to construct a React class per Om component function encountered. defaults to pure-descriptor.

Example:

(build list-of-gadgets x {:init-state {:event-chan ... :narble ...}})

Builds an Om component. Takes an IRender/IRenderState instance
returning function f, a value, and an optional third argument
which may be a map of build specifications.

f - is a function of 2 or 3 arguments. The first argument can be
any value and the second argument will be the owning pure node.
If a map of options m is passed in this will be the third
argument. f must return at a minimum an IRender or IRenderState
instance, this instance may implement other React life cycle
protocols.

x - any value

m - a map the following keys are allowed:

  :key        - a keyword that should be used to look up the key used by
                React itself when rendering sequential things.
  :react-key  - an explicit react key
  :fn         - a function to apply to the data before invoking f.
  :init-state - a map of initial state to pass to the component.
  :state      - a map of state to pass to the component, will be merged in.
  :opts       - a map of values. Can be used to pass side information down
                the render tree.
  :descriptor - a JS object of React methods, will be used to
                construct a React class per Om component function
                encountered. defaults to pure-descriptor.

Example:

  (build list-of-gadgets x
     {:init-state {:event-chan ...
                   :narble ...}})
sourceraw docstring

build*cljs

(build* f cursor)
(build* f cursor m)
source

build-allcljs

(build-all f xs)
(build-all f xs m)

Build a sequence of components. f is the component constructor function, xs a sequence of values, and m a map of options the same as provided to om.core/build.

Build a sequence of components. f is the component constructor
function, xs a sequence of values, and m a map of options the
same as provided to om.core/build.
sourceraw docstring

commit!cljs

(commit! cursor korks f)

EXPERIMENTAL: Like transact! but does not schedule a re-render or create a transact event.

EXPERIMENTAL: Like transact! but does not schedule a re-render or
create a transact event.
sourceraw docstring

componentclj/smacro

(component & body)

Sugar over reify for quickly putting together components that only need to implement om.core/IRender and don't need access to the owner argument.

Sugar over reify for quickly putting together components that
only need to implement om.core/IRender and don't need access to
the owner argument.
sourceraw docstring

component?cljs

(component? x)
source

cursor?cljs

(cursor? x)
source

detach-rootcljs

(detach-root target)

Given a DOM target remove its render loop if one exists.

Given a DOM target remove its render loop if one exists.
sourceraw docstring

get-descriptorcljs

(get-descriptor f)
(get-descriptor f descriptor)
source

get-gstatecljs

(get-gstate owner)
source

get-nodecljs

(get-node owner)
(get-node owner name)

A helper function to get at React DOM refs. Given a owning pure node extract the DOM ref specified by name.

A helper function to get at React DOM refs. Given a owning pure node
extract the DOM ref specified by name.
sourceraw docstring

get-propscljs

(get-props x)
(get-props x korks)

Given an owning Pure node return the Om props. Analogous to React component props.

Given an owning Pure node return the Om props. Analogous to React
component props.
sourceraw docstring

get-refcljs

(get-ref owner name)

A helper function to get at React refs. Given an owning pure node extract the ref specified by name.

A helper function to get at React refs. Given an owning pure node extract
the ref specified by name.
sourceraw docstring

get-render-statecljs

(get-render-state owner)
(get-render-state owner korks)

Takes a pure owning component and an optional key or sequential list of keys and returns a property in the component local state if it exists. Always returns the rendered state, not the pending state.

Takes a pure owning component and an optional key or sequential
list of keys and returns a property in the component local state if
it exists. Always returns the rendered state, not the pending
state.
sourceraw docstring

get-sharedcljs

(get-shared owner)
(get-shared owner korks)

Takes an owner and returns a map of global shared values for a render loop. An optional key or sequence of keys may be given to extract a specific value.

Takes an owner and returns a map of global shared values for a
render loop. An optional key or sequence of keys may be given to
extract a specific value.
sourceraw docstring

get-statecljs

(get-state owner)
(get-state owner korks)

Returns the component local state of an owning component. owner is the component. An optional key or sequence of keys may be given to extract a specific value. Always returns pending state.

Returns the component local state of an owning component. owner is
the component. An optional key or sequence of keys may be given to
extract a specific value. Always returns pending state.
sourceraw docstring

getfcljs

(getf f cursor)
(getf f cursor opts)
source

IAdaptcljsprotocol

-adaptcljs

(-adapt this other)
source

ICheckStatecljsprotocol

source

ICursorcljsprotocol

-statecljs

(-state cursor)

-pathcljs

(-path cursor)
source

ICursorDerivecljsprotocol

-derivecljs

(-derive cursor derived state path)
source

idcljs

(id owner)
source

IDidMountcljsprotocol

did-mountcljs

(did-mount this)
source

IDidUpdatecljsprotocol

did-updatecljs

(did-update this prev-props prev-state)
source

IDisplayNamecljsprotocol

display-namecljs

(display-name this)
source

IGetRenderStatecljsprotocol

-get-render-statecljs

(-get-render-state this)
(-get-render-state this ks)
source

IGetStatecljsprotocol

-get-statecljs

(-get-state this)
(-get-state this ks)
source

IInitStatecljsprotocol

init-statecljs

(init-state this)
source

IndexedCursorcljs

source

INotifycljsprotocol

-unlisten!cljs

(-unlisten! x key)

-listen!cljs

(-listen! x key tx-listen)

-notify!cljs

(-notify! x tx-data root-cursor)
source

IOmRefcljsprotocol

-refresh-deps!cljs

(-refresh-deps! this)

-add-dep!cljs

(-add-dep! this c)

-get-depscljs

(-get-deps this)

-remove-dep!cljs

(-remove-dep! this c)
source

IOmSwapcljsprotocol

-om-swap!cljs

(-om-swap! this cursor korks f tag)
source

IRendercljsprotocol

rendercljs

(render this)
source

IRenderPropscljsprotocol

render-propscljs

(render-props this props state)
source

IRenderQueuecljsprotocol

-get-queuecljs

(-get-queue this)

-queue-render!cljs

(-queue-render! this c)

-empty-queue!cljs

(-empty-queue! this)
source

IRenderStatecljsprotocol

render-statecljs

(render-state this state)
source

IRootKeycljsprotocol

-root-keycljs

(-root-key cursor)
source

IRootPropertiescljsprotocol

-set-property!cljs

(-set-property! this id p val)

-remove-property!cljs

(-remove-property! this id p)

-get-propertycljs

(-get-property this id p)

-remove-properties!cljs

(-remove-properties! this id)
source

ISetStatecljsprotocol

-set-state!cljs

(-set-state! this val render)
(-set-state! this ks val render)
source

IShouldUpdatecljsprotocol

should-updatecljs

(should-update this next-props next-state)
source

IToCursorcljsprotocol

-to-cursorcljs

(-to-cursor value state)
(-to-cursor value state path)
source

ITransactcljsprotocol

-transact!cljs

(-transact! cursor korks f tag)
source

IValuecljsprotocol

-valuecljs

(-value x)
source

IWillMountcljsprotocol

will-mountcljs

(will-mount this)
source

IWillReceivePropscljsprotocol

will-receive-propscljs

(will-receive-props this next-props)
source

IWillUnmountcljsprotocol

will-unmountcljs

(will-unmount this)
source

IWillUpdatecljsprotocol

will-updatecljs

(will-update this next-props next-state)
source

MapCursorcljs

source

mounted?cljs

(mounted? owner)

Return true if the backing React component is mounted into the DOM.

Return true if the backing React component is mounted into the DOM.
sourceraw docstring

no-local-descriptorcljs

(no-local-descriptor methods)
source

no-local-merge-pending-statecljs

(no-local-merge-pending-state owner)
source

no-local-state-methodscljs

source

notify*cljs

(notify* cursor tx-data)
source

observecljs

(observe c ref)

Given a component and a reference cursor have the component observe the reference cursor for any data changes.

Given a component and a reference cursor have the component observe
the reference cursor for any data changes.
sourceraw docstring

pathcljs

(path cursor)
source

pure-descriptorcljs

source

pure-methodscljs

source

react-idcljs

(react-id x)
source

ref-changed?cljs

(ref-changed? ref)
source

ref-cursorcljs

(ref-cursor cursor)

Given a cursor return a reference cursor that inherits all of the properties and methods of the cursor. Reference cursors may be observed via om.core/observe.

Given a cursor return a reference cursor that inherits all of the
properties and methods of the cursor. Reference cursors may be
observed via om.core/observe.
sourceraw docstring

ref-cursor?cljs

(ref-cursor? x)
source

ref-sub-cursorcljs

(ref-sub-cursor x parent)
source

refresh!cljs

(refresh! owner)

Utility to re-render an owner.

Utility to re-render an owner.
sourceraw docstring

refresh-props!cljs

source

remove-ref-from-component!cljs

(remove-ref-from-component! c ref)
source

render-allcljs

(render-all)
(render-all state)

Force a render of all roots. Usage of this function is almost never recommended.

Force a render of *all* roots. Usage of this function is almost
never recommended.
sourceraw docstring

rootcljs

(root f
      value
      {:keys [target tx-listen path instrument descriptor adapt raf]
       :as options})

Take a component constructor function f, value an immutable tree of associative data structures optionally an wrapped in an IAtom instance, and a map of options and installs an Om/React render loop.

f must return an instance that at a minimum implements IRender or IRenderState (it may implement other React life cycle protocols). f must take at least two arguments, the root cursor and the owning pure node. A cursor is just the original data wrapped in an ICursor instance which maintains path information. Only one root render loop allowed per target element. om.core/root is idempotent, if called again on the same target element the previous render loop will be replaced.

Options may also include any key allowed by om.core/build to customize f. In addition om.core/root supports the following special options:

:target - (required) a DOM element. :shared - data to be shared by all components, see om.core/get-shared :tx-listen - a function that will listen in in transactions, should take 2 arguments - the first a map containing the path, old and new state at path, old and new global state, and transaction tag if provided. :instrument - a function of three arguments that if provided will intercept all calls to om.core/build. This function should correspond to the three arity version of om.core/build. :adapt - a function to adapt the root cursor :raf - override requestAnimationFrame based rendering. If false setTimeout will be use. If given a function will be invoked instead.

Example:

(root (fn [data owner] ...) {:message :hello} {:target js/document.body})

Take a component constructor function f, value an immutable tree of
associative data structures optionally an wrapped in an IAtom
instance, and a map of options and installs an Om/React render
loop.

f must return an instance that at a minimum implements IRender or
IRenderState (it may implement other React life cycle protocols). f
must take at least two arguments, the root cursor and the owning pure
node. A cursor is just the original data wrapped in an ICursor
instance which maintains path information. Only one root render
loop allowed per target element. om.core/root is idempotent, if
called again on the same target element the previous render loop
will be replaced.

Options may also include any key allowed by om.core/build to
customize f. In addition om.core/root supports the following
special options:

:target     - (required) a DOM element. 
:shared     - data to be shared by all components, see om.core/get-shared
:tx-listen  - a function that will listen in in transactions, should
              take 2 arguments - the first a map containing the
              path, old and new state at path, old and new global
              state, and transaction tag if provided.
:instrument - a function of three arguments that if provided will
              intercept all calls to om.core/build. This function should
              correspond to the three arity version of om.core/build.
:adapt      - a function to adapt the root cursor
:raf        - override requestAnimationFrame based rendering. If
              false setTimeout will be use. If given a function
              will be invoked instead.

Example:

(root
  (fn [data owner]
    ...)
  {:message :hello}
  {:target js/document.body})
sourceraw docstring

root-cursorcljs

(root-cursor atom)

Given an application state atom return a root cursor for it.

Given an application state atom return a root cursor for it.
sourceraw docstring

set-state!cljs

(set-state! owner v)
(set-state! owner korks v)

Takes a pure owning component, a sequential list of keys and value and sets the state of the component. Conceptually analagous to React setState. Will schedule an Om re-render.

Takes a pure owning component, a sequential list of keys and value and
sets the state of the component. Conceptually analagous to React
setState. Will schedule an Om re-render.
sourceraw docstring

set-state-nr!cljs

(set-state-nr! owner v)
(set-state-nr! owner korks v)

EXPERIMENTAL: Same as set-state! but does not trigger re-render.

EXPERIMENTAL: Same as set-state! but does not trigger re-render.
sourceraw docstring

specify-state-methods!cljs

(specify-state-methods! obj)
source

statecljs

(state cursor)
source

tag-root-keycljs

(tag-root-key cursor root-key)
source

transact!cljs

(transact! cursor f)
(transact! cursor korks f)
(transact! cursor korks f tag)

Given a tag, a cursor, an optional list of keys ks, mutate the tree at the path specified by the cursor + the optional keys by applying f to the specified value in the tree. An Om re-render will be triggered.

Given a tag, a cursor, an optional list of keys ks, mutate the tree
at the path specified by the cursor + the optional keys by applying
f to the specified value in the tree. An Om re-render will be
triggered.
sourceraw docstring

transact*cljs

(transact* state cursor korks f tag)
source

transactable?cljs

(transactable? x)
source

unobservecljs

(unobserve c ref)
source

update!cljs

(update! cursor v)
(update! cursor korks v)
(update! cursor korks v tag)

Like transact! but no function provided, instead a replacement value is given.

Like transact! but no function provided, instead a replacement
value is given.
sourceraw docstring

update-refscljs

(update-refs c)
source

update-state!cljs

(update-state! owner f)
(update-state! owner korks f)

Takes a pure owning component, a sequential list of keys and a function to transition the state of the component. Conceptually analagous to React setState. Will schedule an Om re-render.

Takes a pure owning component, a sequential list of keys and a
function to transition the state of the component. Conceptually
analagous to React setState. Will schedule an Om re-render.
sourceraw docstring

update-state-nr!cljs

(update-state-nr! owner f)
(update-state-nr! owner korks f)

EXPERIMENTAL: Same as update-state! but does not trigger re-render.

EXPERIMENTAL: Same as update-state! but does not trigger re-render.
sourceraw docstring

valid?cljs

(valid? x)
source

valuecljs

(value cursor)
source

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

× close