Liking cljdoc? Tell your friends :D

com.fulcrologic.fulcro.routing.dynamic-routing


accepts-route?clj/s

(accepts-route? component path)

Returns true if the given component is a router that manages a route target that will accept the given path.

Returns true if the given component is a router that manages a route target that will accept the given path.
sourceraw docstring

all-reachable-routersclj/s

(all-reachable-routers state-map component-class)

Returns a sequence of all of the routers reachable in the query of the app.

Returns a sequence of all of the routers reachable in the query of the app.
sourceraw docstring

apply-routeclj/s

Mutation: Indicate that a given route is ready and should show the result.

router - The ident of the router, with metadata :component that is the class of the router. target - The ident of the target route, with metadata :component that is the class of the target.

Mutation: Indicate that a given route is ready and should show the result.

router - The ident of the router, with metadata :component that is the class of the router.
target - The ident of the target route, with metadata :component that is the class of the target.
sourceraw docstring

ast-node-for-live-routerclj/s

(ast-node-for-live-router app {:keys [component children] :as ast-node})

Returns the AST node for a query that represents the closest "live" (on-screen) router

ast - A query AST node

Returns an AST node or nil if none is found.

Returns the AST node for a query that represents the closest "live" (on-screen) router

ast - A query AST node

Returns an AST node or nil if none is found.
sourceraw docstring

ast-node-for-routeclj/s

(ast-node-for-route {:keys [component children] :as ast-node} path)

Returns the AST node for a query that represents the router that has a target that can accept the given path. This is a breadth-first search.

ast - A query AST node path - A vector of the current URI segments.

Returns an AST node or nil if none is found.

Returns the AST node for a query that represents the router that has a target that can accept the given path. This is a breadth-first
search.

ast - A query AST node
path - A vector of the current URI segments.

Returns an AST node or nil if none is found.
sourceraw docstring

change-routeclj/s

(change-route this new-route)
(change-route this new-route timeouts)

Trigger a route change.

this - The component (or app) that is causing the route change. new-route - A vector of URI components to pass to the router. timeouts - A map of timeouts that affect UI during deferred routes: {:error-timeout ms :deferred-timeout ms}

The error timeout is how long to wait (default 5000ms) before showing the error-ui of a route (which must be defined on the router that is having problems). The deferred-timeout (default 100ms) is how long to wait before showing the loading-ui of a deferred router (to prevent flicker).

Trigger a route change.

this - The component (or app) that is causing the route change.
new-route - A vector of URI components to pass to the router.
timeouts - A map of timeouts that affect UI during deferred routes: {:error-timeout ms :deferred-timeout ms}

The error timeout is how long to wait  (default 5000ms) before showing the error-ui of a route (which must be defined on the
router that is having problems).  The deferred-timeout (default 100ms) is how long to wait before showing the loading-ui of
a deferred router (to prevent flicker).
sourceraw docstring

change-route-relativeclj/s

(change-route-relative this-or-app relative-class-or-instance new-route)
(change-route-relative app-or-comp
                       relative-class-or-instance
                       new-route
                       timeouts)

Change the route, starting at the given Fulcro class or instance (scanning for the first router from there). new-route is a vector of string components to pass through to the nearest child router as the new path. The first argument is any live component or the app. The timeouts are as in change-route. It is safe to call this from within a mutation.

Change the route, starting at the given Fulcro class or instance (scanning for the first router from there).  `new-route` is a vector
of string components to pass through to the nearest child router as the new path. The first argument is any live component
or the app.  The `timeouts` are as in `change-route`.
It is safe to call this from within a mutation.
sourceraw docstring

compile-errorclj

(compile-error env form message)
source

current-routeclj/s

(current-route this-or-app relative-class-or-instance)

Returns the current active route, starting from the relative Fulcro class or instance.

Any component using this as a basis for rendering will need to add the following to their query to ensure the props of that component change on route changes:

[::uism/asm-id fq-router-kw]

where fq-router-kw is a keyword that has the exact namespace and name of the router you're interested in. If you want to just over-render you can use a quoted _ instead.

Returns the current active route, starting from the relative Fulcro class or instance.

Any component using this as a basis for rendering will need to add the following to their query to
ensure the props of that component change on route changes:

```
[::uism/asm-id fq-router-kw]
```

where `fq-router-kw` is a keyword that has the exact namespace and name of the router you're interested in. If you want
to just over-render you can use a quoted `_` instead.
sourceraw docstring

current-route-classclj/s

(current-route-class this)

Get the class of the component that is currently being routed to.

Get the class of the component that is currently being routed to.
sourceraw docstring

defrouterclj/smacro

(defrouter router-sym arglist options & body)

Define a router.

The arglist is [this props], which are just like defsc. The props will contains :current-state and :pending-path-segment.

The options are:

:router-targets - (REQUIRED) A vector of ui components that are router targets. The first one is considered the "default". Other defsc options - (LIMITED) You may not specify query/initial-state/protocols/ident, but you can define things like react lifecycle methods. See defsc.

The optional body, if defined, will only be used if the router is in one of the following states:

  • :initial - No route is set.
  • :pending - A deferred route is taking longer than expected (configurable timeout, default 100ms)
  • :failed - A deferred route took longer than can reasonably be expected (configurable timeout, default 5s)

otherwise the actual active route target will be rendered.

Define a router.

The arglist is `[this props]`, which are just like defsc. The props will contains :current-state and :pending-path-segment.

The options are:

`:router-targets` - (REQUIRED) A *vector* of ui components that are router targets. The first one is considered the "default".
Other defsc options - (LIMITED) You may not specify query/initial-state/protocols/ident, but you can define things like react
lifecycle methods. See defsc.

The optional body, if defined, will *only* be used if the router is in one of the following states:

- `:initial` - No route is set.
- `:pending` - A deferred route is taking longer than expected (configurable timeout, default 100ms)
- `:failed` - A deferred route took longer than can reasonably be expected (configurable timeout, default 5s)

otherwise the actual active route target will be rendered.
sourceraw docstring

defrouter*clj

(defrouter* env router-ns router-sym arglist options body)
source

fail-handlerclj/s

(fail-handler env)
source

get-route-cancelledclj/s

(get-route-cancelled class)
source

get-targetsclj/s

(get-targets router)
source

get-will-enterclj/s

(get-will-enter class)
source

get-will-leaveclj/s

(get-will-leave this)
source

immediate?clj/s

(immediate? ident)
source

mark-route-pending*clj/s

(mark-route-pending* state-map {:keys [router target] :as params})
source

matching-prefixclj/s

(matching-prefix route-segment actual-path)

Returns the elements of actual-path that match the route-segment definition.

Returns the elements of actual-path that match the route-segment definition.
sourceraw docstring

proposed-new-pathclj/s

(proposed-new-path this-or-app relative-class-or-instance new-route)
source

ready-handlerclj/s

(ready-handler env)
source

route-cancelledclj/s

(route-cancelled class route-params)

Universal CLJC version of will-enter. Don't use the protocol method in CLJ.

Universal CLJC version of will-enter.  Don't use the protocol method in CLJ.
sourceraw docstring

route-deferredclj/s

(route-deferred ident completion-fn)
source

route-handlerclj/s

(route-handler {:com.fulcrologic.fulcro.ui-state-machines/keys [event-data]
                :as env})
source

route-immediateclj/s

(route-immediate ident)
source

route-lifecycle?clj/s

(route-lifecycle? component)
source

route-segmentclj/s

(route-segment class)
source

route-targetclj/s

(route-target router-class path)

Given a router class and a path segment, returns the class of the router-class that is the target of the given URI path, which is a vector of (string) URI components.

Returns nil if there is no target that accepts the path, or a map containing:

{:target class :matching-prefix prefix}

where class is the component class that accepts the path (the target, NOT the router), and matching-prefix is the portion of the path that is accepted by that class.

NOTE: If more than one target matches, then the target with the longest match will be returned. A warning will be printed if more than one match of equal length is found.

Given a router class and a path segment, returns the class of the router-class that is the target of the given URI path,
which is a vector of (string) URI components.

Returns nil if there is no target that accepts the path, or a map containing:

{:target class
 :matching-prefix prefix}

where `class` is the component class that accepts the path (the target, NOT the router), and `matching-prefix` is the
portion of the path that is accepted by that class.

NOTE: If more than one target matches, then the target with the longest match will be returned. A warning will be
printed if more than one match of equal length is found.
sourceraw docstring

route-target?clj/s

(route-target? component)
source

router-for-pending-targetclj/s

(router-for-pending-target state-map target)
source

router?clj/s

(router? component)
source

RouterStateMachineclj/s

source

signal-router-leavingclj/s

(signal-router-leaving app-or-comp relative-class-or-instance new-route)

Tell active routers that they are about to leave the screen. Returns false if any of them deny the route change.

Tell active routers that they are about to leave the screen. Returns false if any of them deny the route change.
sourceraw docstring

target-readyclj/s

Mutation: Indicate that a target is ready.

Mutation: Indicate that a target is ready.
sourceraw docstring

target-ready!clj/s

(target-ready! component-or-app target)

Indicate a target is ready. Safe to use from within mutations.

target - The ident that was originally listed as a deferred target.

Indicate a target is ready.  Safe to use from within mutations.

target - The ident that was originally listed as a deferred target.
sourceraw docstring

will-enterclj/s

(will-enter class app params)

Universal CLJC version of will-enter. Don't use the protocol method in CLJ.

Universal CLJC version of will-enter.  Don't use the protocol method in CLJ.
sourceraw docstring

will-leaveclj/s

(will-leave c props)
source

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

× close