(->ms x)
Tries to convert x
to a number of milliseconds. x
should be a
number or something that satisfies Duration.
Tries to convert `x` to a number of milliseconds. `x` should be a number or something that satisfies Duration.
(async f & args)
Call f
with args
asynchronously. Returns something that satisfies Chain.
Call `f` with `args` asynchronously. Returns something that satisfies Chain.
(cancel-scheduled x)
Cancel something that was scheduled via schedule-once
or schedule-every
Cancel something that was scheduled via `schedule-once` or `schedule-every`
(chain-all form continue & {:keys [mapper]})
Walks the given form
, resolving anything that satisfies Chain, then
calling continue
with the resulting form.
If any of the values that satisfy Chain resolve to an error, immediately
calls continue
with the error.
If a mapper
is given, it will be called to substitute each subform before
checking if it satisfies Chain.
Returns nil
.
Walks the given `form`, resolving anything that satisfies Chain, then calling `continue` with the resulting form. If any of the values that satisfy Chain resolve to an error, immediately calls `continue` with the error. If a `mapper` is given, it will be called to substitute each subform before checking if it satisfies Chain. Returns `nil`.
(chainable f)
Calls f
with a continue
function. Returns something that satisfies
Chain, and resolves to the value passed to continue
, when it's called.
Calls `f` with a `continue` function. Returns something that satisfies Chain, and resolves to the value passed to `continue`, when it's called.
(clock period)
Creates a signal that triggers every period
. Must dispose.
Creates a signal that triggers every `period`. Must dispose.
(dispose! x)
If x
satisfies Dispose, invokes its dispose implementation. Otherwise
does nothing.
If `x` satisfies Dispose, invokes its dispose implementation. Otherwise does nothing.
(err & data)
Create an error value with the given data.
Create an error value with the given data.
Use with (m :catch err-any err ...)
. Matches any error.
Use with `(m :catch err-any err ...)`. Matches any error.
(err-data err)
Returns the data associated with err
if it's an error value.
Otherwise null
.
Returns the data associated with `err` if it's an error value. Otherwise `null`.
Use with (m :catch (err-where pred) err ...)
. Matches any
error for which pred
is truthy.
Use with `(m :catch (err-where pred) err ...)`. Matches any error for which `pred` is truthy.
(get-in-config path)
(get-in-config path default)
Grab something from the deps basis. Careful, this inlines the result during macro expansion, and doesn't quote.
Grab something from the deps basis. Careful, this inlines the result during macro expansion, and doesn't quote.
(m & stuff)
Multi-faceted block. Basically a do
with special inline directives
to mitigate nesting and allow for more concise code.
(m
... some stufff...
:catch b/any-err err
... some more stuff ...
:let
[...bindings]
:cond
[my-pred-1 return-value-1
my-pred-2 return-value-2]
:await
[p1 parallel-expression-1
p2 parallel-expression-2]
:dispose
[r1 my-resource-1
r2 my-resource-2]
:finally
...finally body...)
Multi-faceted block. Basically a `do` with special inline directives to mitigate nesting and allow for more concise code. ``` (m ... some stufff... :catch b/any-err err ... some more stuff ... :let [...bindings] :cond [my-pred-1 return-value-1 my-pred-2 return-value-2] :await [p1 parallel-expression-1 p2 parallel-expression-2] :dispose [r1 my-resource-1 r2 my-resource-2] :finally ...finally body...) ```
(notifier-listen notifier f)
(notifier-listen notifier k f)
Add a listener to something that satisfies the Notifier protocol.
Add a listener to something that satisfies the Notifier protocol.
(notifier-unlisten notifier k)
Remove a listener from something that satisfies the Notifier protocol.
Remove a listener from something that satisfies the Notifier protocol.
(path-unwatch pw k)
Remove a path watch. The k
should be the key originally passed to
path-watch
.
Remove a path watch. The `k` should be the key originally passed to `path-watch`.
(path-watch pw k path f)
Watch a path on something that satisfies PathWatchable.
The f
will be called with (old-val, new-val, changed-paths)
each
time something under the path
changes. The changed-paths
will be
a set indicating more specifically the subpaths that were changed, or
#{[]}
if not known.
Watch a path on something that satisfies PathWatchable. The `f` will be called with `(old-val, new-val, changed-paths)` each time something under the `path` changes. The `changed-paths` will be a set indicating more specifically the subpaths that were changed, or `#{[]}` if not known.
(schedule-every delay f & args)
Schedule f
to be called with args
after waiting the given delay
,
and then subsequently after every delay
until cancelled.
Delay can be a number (in milliseconds) or anything that satisfies the Duration protocol
Returns something that can be cancelled via cancel-scheduled
.
Schedule `f` to be called with `args` after waiting the given `delay`, and then subsequently after every `delay` until cancelled. Delay can be a number (in milliseconds) or anything that satisfies the Duration protocol Returns something that can be cancelled via `cancel-scheduled`.
(schedule-once delay f & args)
Schedule f
to be called with args
after waiting the given delay
.
Delay can be a number (in milliseconds) or anything that satisfies the Duration protocol.
Returns something that can be cancelled via cancel-scheduled
.
Schedule `f` to be called with `args` after waiting the given `delay`. Delay can be a number (in milliseconds) or anything that satisfies the Duration protocol. Returns something that can be cancelled via `cancel-scheduled`.
(signal)
(signal finalizer)
Create a signal. Listen with notifier-listen
, stop listening
with notifier-unlisten
, and invoke all listeners by calling the
the signal.
If a finalizer
is provided, it will be called when the signal
is disposed.
Create a signal. Listen with `notifier-listen`, stop listening with `notifier-unlisten`, and invoke all listeners by calling the the signal. If a `finalizer` is provided, it will be called when the signal is disposed.
(signal? x)
Return true if x
is a signal
Return true if `x` is a signal
(with-dispose & stuff)
Execute the body, calling dispose!
on all bound values
when leaving the body.
(with-dispose
[res1 (create-resource)
res2 (create-resource)]
...)
Execute the body, calling `dispose!` on all bound values when leaving the body. ``` (with-dispose [res1 (create-resource) res2 (create-resource)] ...) ```
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close