Liking cljdoc? Tell your friends :D

fulcro.client


-abort-items-on-queueclj/s

(-abort-items-on-queue queue abort-id)

PRIVATE

PRIVATE
raw docstring

-initializeclj/s

(-initialize {:keys [networking read-local started-callback query-interpreter]
              :as app}
             initial-state
             root-component
             dom-id-or-node
             reconciler-options)

PRIVATE.

Initialize the fulcro Application. Creates network queue, sets up i18n, creates reconciler, mounts it, and returns the initialized app

PRIVATE.

Initialize the fulcro Application. Creates network queue, sets up i18n, creates reconciler, mounts it, and returns
the initialized app
raw docstring

-mutation-query?clj/s

(-mutation-query? tx)

PRIVATE

PRIVATE
raw docstring

Applicationcljs


clear-queueclj/s

(clear-queue queue)

Needed for mocking in tests. Do not use directly. Use FulcroApplication protocol methods instead.

Needed for mocking in tests. Do not use directly. Use FulcroApplication protocol methods instead.
raw docstring

fulcro-toolsclj/s


FulcroApplicationclj/s≠protocol

mountclj/s

(mount this root-component target-dom-id)

Start/replace the webapp on the given DOM ID or DOM Node.

Start/replace the webapp on the given DOM ID or DOM Node.

abort-request!clj/s

(abort-request! this abort-id)

Abort the given request on all remotes. abort-id is a self-assigned ID for the remote interaction.

Abort the given request on all remotes. abort-id is a self-assigned ID for the remote interaction.

reset-state!clj/s

(reset-state! this new-state)

Replace the entire app state with the given (pre-normalized) state.

Replace the entire app state with the given (pre-normalized) state.

refreshclj/s

(refresh this)

Refresh the UI (force re-render).

Refresh the UI (force re-render).

clear-pending-remote-requests!clj/s

(clear-pending-remote-requests! this remotes)

Remove all pending network requests on the given remote(s). Useful on failures to eliminate cascading failures. Remote can be a keyword, set, or nil. nil means all remotes.

Remove all pending network requests on the given remote(s). Useful on failures to eliminate cascading failures. Remote can be a keyword, set, or nil. `nil` means all remotes.

reset-history!clj/s

(reset-history! this)

Returns the application with history reset to its initial, empty state. Resets application history to its initial, empty state. Suitable for resetting the app for situations such as user log out.

Returns the application with history reset to its initial, empty state. Resets application history to its initial, empty state. Suitable for resetting the app for situations such as user log out.

historyclj/s

(history this)

Return the current UI history of the application, suitable for network transfer

Return the current UI history of the application, suitable for network transfer

reset-app!clj/s

(reset-app! this root-component callback)

Replace the entire app state with the initial app state defined on the root component (includes auto-merging of unions). callback can be nil, a function, or :original (to call original started-callback).

Replace the entire app state with the initial app state defined on the root component (includes auto-merging of unions). callback can be nil, a function, or :original (to call original started-callback).

get-urlcljs

(get-url)

Get the current window location from the browser

Get the current window location from the browser
raw docstring

get-url-paramcljs

(get-url-param param-name)
(get-url-param url param-name)

Get the value of the named parameter from the browser URL (or an explicit one)

Get the value of the named parameter from the browser URL (or an explicit one)
raw docstring

iident?clj/s

DEPRECATED: Now defined in fulcro.client.primitives

DEPRECATED: Now defined in fulcro.client.primitives
raw docstring

iinitial-app-state?clj/s

DEPRECATED: Now defined in fulcro.client.primitives

DEPRECATED: Now defined in fulcro.client.primitives
raw docstring

integrate-identclj/s

DEPRECATED: Now defined in fulcro.client.primitives

DEPRECATED: Now defined in fulcro.client.primitives
raw docstring

integrate-ident!clj/s

DEPRECATED: Now defined in fulcro.client.primitives

DEPRECATED: Now defined in fulcro.client.primitives
raw docstring

make-fulcro-clientclj/s

(make-fulcro-client)
(make-fulcro-client {:keys [initial-state mutation-merge client-did-mount
                            networking reconciler-options query-interpreter
                            read-local request-transform network-error-callback
                            migrate transit-handlers shared load-marker-default
                            query-transform-default]
                     :or {initial-state {}
                          read-local (constantly false)
                          client-did-mount (constantly nil)
                          network-error-callback (constantly nil)
                          migrate nil
                          shared nil
                          load-marker-default false}
                     :as options})

Entry point for creating a new fulcro client. Instantiates an Application with default values, unless overridden by the parameters. If you do not supply a networking object, one will be provided that connects to the same server the application was served from, at /api.

:request-transform DEPRECATED. ONLY WORKS WITH DEFAULT REMOTE. Use a custom remote with client middleware instead. If supplied it must be a function:

(fn [{:keys [body headers]}] {:body body' :headers headers'})

it can replace the outgoing EDN of body or headers (returning both as a vector). NOTE: Both of these are clojurescript types. The edn will be encoded with transit, and the headers will be converted to a js map. IMPORTANT: Only supported when using the default built-in single-remote networking.

:initial-state is your applications initial state. If it is an atom, it must be normalized. Fulcro databases always have normalization turned on (for server data merging). If it is not an atom, it will be auto-normalized.

:client-did-mount is an optional function that will receive the intialized fulcro application after it is mounted in the DOM, and is useful for triggering initial loads, routing mutations, etc. The reconciler is available under the :reconciler key (and you can access the app state, root node, etc from there.). The legacy name of this option (:started-callback) is still supported, but is deprecated.

:network-error-callback. DEPRECATED. Use a custom remote with middleware instead. This is a function of three arguments, the app state atom, status code, and the error, which will be invoked for every network error (status code >= 400, or no network found). Only works if you choose to use the default built-in networking (ignored if you specify :networking).

:transit-handlers (optional). DEPRECATED: Use a custom client network with middleware instead.

:shared (optional). A map of arbitrary values to be shared across all components, accessible to them via (prim/shared this)

:load-marker-default (optional) A default value to use for the :marker option of loads (default is false which means no markers).

:query-transform-default (optional) A (fn [query] query) that is used as the default :update-query for data-detch/load parameters. This can be used to customize things like preventing certain keywords from ever appearing in the remote version of a component's query. See fulcro.client.elide-query-nodes for an idea of a common helper.

:read-local (optional). DEPRECATED. DO NOT USE.

:query-interpreter (optional). A custom query engine (parser and interpreter) that will be used to satisfy all local client queries from the local state database. Cannot be used with :read-local. It must be a (fn [env query] ) that returns the result for the given query. It will not be given mutations. The env will contain the :state atom, :shared, and :parser. It may also contain the :reconciler.

:networking (optional). An instance of FulcroNetwork that will act as the default remote (named :remote). If you want to support multiple remotes, then this should be a map whose keys are the keyword names of the remotes and whose values are FulcroNetwork instances.

`:mutation-merge (optional). DEPRECATED. Use mutation joins or network middleware instead.

:reconciler-options (optional). A map that will be merged into the reconciler options. Currently it's mostly useful to override things like :root-render and :root-unmount for React Native Apps.

Entry point for creating a new fulcro client. Instantiates an Application with default values, unless
 overridden by the parameters. If you do not supply a networking object, one will be provided that connects to the
 same server the application was served from, at `/api`.

 `:request-transform` DEPRECATED. ONLY WORKS WITH DEFAULT REMOTE. Use a custom remote with client middleware instead.
 If supplied it must be a function:

 ```
(fn [{:keys [body headers]}] {:body body' :headers headers'})
 ```

 it can replace the outgoing EDN of body or headers (returning both as a vector). NOTE: Both of these are clojurescript types.
 The edn will be encoded with transit, and the headers will be converted to a js map. IMPORTANT: Only supported
 when using the default built-in single-remote networking.

 `:initial-state` is your applications initial state. If it is an atom, it *must* be normalized. Fulcro databases
 always have normalization turned on (for server data merging). If it is not an atom, it will be auto-normalized.

 `:client-did-mount` is an optional function that will receive the intialized fulcro application after it is
 mounted in the DOM, and is useful for triggering initial loads, routing mutations, etc. The reconciler is available
 under the `:reconciler` key (and you can access the app state, root node, etc from there.). The legacy name of
 this option (:started-callback) is still supported, but is deprecated.

 `:network-error-callback`. DEPRECATED. Use a custom remote with middleware instead.
 This is a function of three arguments, the app state atom, status code, and the error, which will be invoked for
 every network error (status code >= 400, or no network found). Only works if you choose to use the default built-in
 networking (ignored if you specify :networking).

 `:transit-handlers` (optional). DEPRECATED: Use a custom client network with middleware instead.

 `:shared` (optional). A map of arbitrary values to be shared across all components, accessible to them via (prim/shared this)

 `:load-marker-default` (optional) A default value to use for the `:marker` option of loads (default is false which means
 no markers).

 `:query-transform-default` (optional) A (fn [query] query) that is used as the default `:update-query` for data-detch/load parameters.
 This can be used to customize things like preventing certain keywords from ever appearing in the remote version of a
 component's query. See `fulcro.client.elide-query-nodes` for an idea of a common helper.

 `:read-local` (optional). DEPRECATED. DO NOT USE.

 `:query-interpreter` (optional). A custom query engine (parser and interpreter) that will be used to satisfy all
 local client queries from the local state database. Cannot be used with `:read-local`.
 It must be a `(fn [env query] )` that returns the result for the given query. It will not be given mutations.
 The `env` will contain the `:state` atom, `:shared`, and `:parser`. It may also contain the `:reconciler`.

 `:networking` (optional). An instance of FulcroNetwork that will act as the default remote (named :remote). If
 you want to support multiple remotes, then this should be a map whose keys are the keyword names of the remotes
 and whose values are FulcroNetwork instances.

 `:mutation-merge (optional). DEPRECATED. Use mutation joins or network middleware instead.

 `:reconciler-options (optional). A map that will be merged into the reconciler options. Currently it's mostly
 useful to override things like :root-render and :root-unmount for React Native Apps.`
 
raw docstring

make-fulcro-test-clientclj/s

(make-fulcro-test-client &
                         {:keys [initial-state started-callback
                                 reconciler-options]
                          :or {initial-state {} started-callback nil}})

Create a test client that has no networking. Useful for UI testing with a real Fulcro app container.

Create a test client that has no networking. Useful for UI testing with a real Fulcro app container.
raw docstring

merge-alternate-union-elementsclj/s

DEPRECATED: Now defined in fulcro.client.primitives

DEPRECATED: Now defined in fulcro.client.primitives
raw docstring

merge-alternate-union-elements!clj/s

DEPRECATED: Now defined in fulcro.client.primitives

DEPRECATED: Now defined in fulcro.client.primitives
raw docstring

merge-alternate-unionsclj/s

DEPRECATED: Now defined in fulcro.client.primitives

DEPRECATED: Now defined in fulcro.client.primitives
raw docstring

merge-componentclj/s

DEPRECATED: Now defined in fulcro.client.primitives

DEPRECATED: Now defined in fulcro.client.primitives
raw docstring

merge-state!clj/s

(merge-state! app-or-reconciler component object-data & named-params)

See primitives/merge-component!

See primitives/merge-component!
raw docstring

mount*clj/s

(mount* {:keys [mounted? initial-state reconciler-options] :as app}
        root-component
        dom-id-or-node)

mutateclj/s


new-fulcro-clientclj/s

(new-fulcro-client & {:as options})

Deprecated: use make-fulcro-client instead.

Deprecated: use make-fulcro-client instead.
raw docstring

new-fulcro-test-clientclj/s

(new-fulcro-test-client &
                        {:keys [initial-state started-callback
                                reconciler-options]
                         :or {initial-state {} started-callback nil}})

DEPRECATED: use make-fulcro-test-client instead

DEPRECATED: use make-fulcro-test-client instead
raw docstring

refresh*clj/s

(refresh* {:keys [reconciler] :as app} root target)

register-toolclj/s

(register-tool {:keys [:fulcro.client/tool-id] :as tool-registry})

Register a debug tool. When an app starts, the debug tool can have several hooks that are notified:

::tool-id some identifier to place the tool into the tool map ::tx-listen is a (fn [tx info] ...) that will be called on every transact! of the app. Return value is ignored. ::network-wrapper is (fn [network-map] network-map') that will be given the networking config BEFORE it is initialized. You can wrap them, but you MUST return a compatible map out or you'll disable networking. ::component-lifecycle is (fn [component evt]) that is called with evt of :mounted and :unmounted to tell you when the given component mounts/unmounts. ::instrument-wrapper is a (fn [instrument] instrument') that allows you to wrap your own instrumentation (for rendering) around any existing (which may be nil) ::app-started (fn [app] ...) that will be called once the app is mounted, just like started-callback/client-did-mount. Return value is ignored.

Register a debug tool. When an app starts, the debug tool can have several hooks that are notified:

::tool-id some identifier to place the tool into the tool map
::tx-listen is a (fn [tx info] ...) that will be called on every `transact!` of the app. Return value is ignored.
::network-wrapper is (fn [network-map] network-map') that will be given the networking config BEFORE it is initialized. You can wrap
them, but you MUST return a compatible map out or you'll disable networking.
::component-lifecycle is (fn [component evt]) that is called with evt of :mounted and :unmounted to tell you when the given component mounts/unmounts.
::instrument-wrapper is a (fn [instrument] instrument') that allows you to wrap your own instrumentation (for rendering) around any existing (which may be nil)
::app-started (fn [app] ...) that will be called once the app is mounted, just like started-callback/client-did-mount. Return value is ignored.
raw docstring

reset-history-implclj/s

(reset-history-impl {:keys [reconciler]})

Needed for mocking in tests. Use FulcroApplication protocol methods instead.

Needed for mocking in tests. Use FulcroApplication protocol methods instead.
raw docstring

uri-paramscljs

(uri-params)
(uri-params url)

Get the current URI parameters from the browser url or one you supply

Get the current URI parameters from the browser url or one you supply
raw docstring

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

× close