A reactive tree router
A reactive tree router
(adaptive-key key)
Return a lens focusing on the value at key
in an associative data structure.
When updating the focused value by a function f
:
{key (f value)}
(trivial case),key
must be a natural integer. The value at
position key will be updated by f. If key
is out of the array upper bound,
the vector will be resized and padded with nil
.nil
:
key
is a natural integer, then value will default to a vector,Return a lens focusing on the value at `key` in an associative data structure. When updating the focused value by a function `f`: - if value is a map, then the result is equivalent to `{key (f value)}` (trivial case), - if value is vector, then `key` must be a natural integer. The value at position key will be updated by f. If `key` is out of the array upper bound, the vector will be resized and padded with `nil` . - if value is neither a map nor a vector, then value will become {value (f nil)}. - if value is `nil`: - if `key` is a natural integer, then value will default to a vector, - otherwise value will default to a map.
A predicate called on user navigation intent. If false, the current navigation intent is prevented. Called during DOM event bubbling phase, it must be synchronous and therefore must be bound to a clojure function.
A predicate called on user navigation intent. If false, the current navigation intent is prevented. Called during DOM event bubbling phase, it must be synchronous and therefore must be bound to a clojure function.
(OnBeforeNavigate!)
Run for effect on history navigation
Run for effect on history navigation
(OnNavigate Callback)
(OnNavigate node Callback)
Will call Callback
on internal router/Link
click. Callback
takes 2 arguments:
Will call `Callback` on internal `router/Link` click. `Callback` takes 2 arguments: - the route to navigate to - the dom click js event.
(path-lens path)
Given a sequence of keys in an associative data structure (e.g. [:foo :bar 0 :baz]), return a lens focusing on the value at the end of the path. An empty path (e.g. []) is an identity.
Given a sequence of keys in an associative data structure (e.g. [:foo :bar 0 :baz]), return a lens focusing on the value at the end of the path. An empty path (e.g. []) is an identity.
(resolve-path path)
(resolve-path stack [x & xs])
Given a path eventually containing relative path components (e.g. '.
, '..
, or '/
), resolve the final path.
.
is a noop,..
navigates one level up,/
navigates to the root.
e.g.
[:foo '. :bar] => [:foo :bar]
[:foo '. '. :bar] => [:foo :bar]
[:foo :bar '..] => [:foo]
[:foo :bar '.. :baz] => [:foo :baz]
['.. :foo] => [:foo]
['/] => []
[:foo '/] => []
[:foo :bar '/ :baz] => [:baz]Given a path eventually containing relative path components (e.g. `'.`, `'..`, or `'/`), resolve the final path. - `.` is a noop, - `..` navigates one level up, - `/` navigates to the root. e.g. [:foo '. :bar] => [:foo :bar] [:foo '. '. :bar] => [:foo :bar] [:foo :bar '..] => [:foo] [:foo :bar '.. :baz] => [:foo :baz] ['.. :foo] => [:foo] ['/] => [] [:foo '/] => [] [:foo :bar '/ :baz] => [:baz]
Current rout in the scope of a router
Current rout in the scope of a router
(set-key m old-key new-key)
Replaces old-key
in map m
by new-key
without altering the corresponding value.
Similar to clojure.set/rename-keys
, but faster and for a single key.
Replaces `old-key` in map `m` by `new-key` without altering the corresponding value. Similar to `clojure.set/rename-keys`, but faster and for a single key.
(update-key m k f)
Update a key in a map. Replaces key k
in map m
by the result of (f k)
.
The corresponding value is preserved.
Update a key in a map. Replaces key `k` in map `m` by the result of `(f k)`. The corresponding value is preserved.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close