async/await for continuation-passing style (CPS) functions.
This library delivers async/await expressions for use with asynchronous functions that take resolve and raise callbacks as the last parameters (e.g. ring, clj-http...).
async/await for continuation-passing style (CPS) functions. This library delivers async/await expressions for use with asynchronous functions that take resolve and raise callbacks as the last parameters (e.g. ring, clj-http...).
If the raise callback in an async block throws, the exception will be logged with this function.
If the raise callback in an async block throws, the exception will be logged with this function.
(afn name? [params*] body)
Defines an asynchronous function. Declared parameters are extended with two continuation arguments of &resolve and &raise and these continuations will be called with the function result or any exception thrown respectively.
Executes in the calling thread up until the first await clause. Execution is then resumed in the thread awaited function invokes its continuation in. This may still be the calling thread.
Only one arity is allowed.
Defines an asynchronous function. Declared parameters are extended with two continuation arguments of &resolve and &raise and these continuations will be called with the function result or any exception thrown respectively. Executes in the calling thread up until the first await clause. Execution is then resumed in the thread awaited function invokes its continuation in. This may still be the calling thread. Only one arity is allowed.
(async resolve raise & body)
Like ((fn-async [] body*) resolve raise).
Like ((fn-async [] body*) resolve raise).
(await cps-fn & args)
Awaits asynchronous execution of continuation-passing style function cps-fn, applying it to args plus two extra callback functions: resolve and raise. Effectively returns the value passed to resolve or throws the exception passed to raise. Must be called in an asynchronous function.
Awaits asynchronous execution of continuation-passing style function cps-fn, applying it to args plus two extra callback functions: resolve and raise. Effectively returns the value passed to resolve or throws the exception passed to raise. Must be called in an asynchronous function.
(await! f & args)
Like await but blocks the calling thread. Do not use inside an asynchronous function.
Like await but blocks the calling thread. Do not use inside an asynchronous function.
(default-log-raise-exception t)
Default logger for exceptions in raise callbacks prints the message to stdio.
Default logger for exceptions in raise callbacks prints the message to stdio.
(defn-async name doc-string? attr-map? [params*] body)
Same as defn but defines an asynchronous function with extra &resolve and &raise continuation params. Only one arity is allowed.
Same as defn but defines an asynchronous function with extra &resolve and &raise continuation params. Only one arity is allowed.
Deprecated - renamed to afn.
Deprecated - renamed to afn.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close