Liking cljdoc? Tell your friends :D

com.wsscode.async.async-clj


<!cljmacro

(<! & body)

Same as clojure.core.async/<!. Just a convenience place for it.

Same as clojure.core.async/<!. Just a convenience place for it.
sourceraw docstring

<!!cljmacro

(<!! & body)

Same as clojure.core.async/<!!. Just a convenience place for it.

Same as clojure.core.async/<!!. Just a convenience place for it.
sourceraw docstring

<!!maybecljmacro

(<!!maybe x)

Like <!maybe but will block the thread.

Like <!maybe but will block the thread.
sourceraw docstring

<!maybecljmacro

(<!maybe x)

Reads a channel if it is a channel, if it's not a channel, return x.

Reads a channel if it is a channel, if it's not a channel, return x.
sourceraw docstring

<?cljmacro

(<? ch)

Reads a channel value and check if it is an error, in case it is, throw the error.

Reads a channel value and check if it is an error, in case it is, throw the error.
sourceraw docstring

<?!cljmacro

(<?! ch)

Reads a channel value and check if it is an error, in case it is, throw the error.

Reads a channel value and check if it is an error, in case it is, throw the error.
sourceraw docstring

<?!maybecljmacro

(<?!maybe x)

A combination of <!maybe and <?.

A combination of <!maybe and <?.
sourceraw docstring

<?maybecljmacro

(<?maybe x)

A combination of <!maybe and <?.

A combination of <!maybe and <?.
sourceraw docstring

async-testcljmacro

(async-test & body)

Ths is similar to the CLJS version for async test, but on the Clojure side the async helper doesn't exist, instead of using that we block on the wrapper go block. Example:

(deftest async-test
  (wa/async-test
    (is (= 42 (<! (some-async-op)))))

This will also add a timeout (default 2000ms), to change the timeout you can send a map with configuration after the test symbol, example:

(deftest async-test
  (wa/async-test
    {::wa/timeout 5000} ; 5000ms timeout
    (is (= 42 (<! (some-async-op)))))
Ths is similar to the CLJS version for async test, but on the Clojure side the `async`
helper doesn't exist, instead of using that we block on the wrapper go block. Example:

    (deftest async-test
      (wa/async-test
        (is (= 42 (<! (some-async-op)))))

This will also add a timeout (default 2000ms), to change the timeout you can send
a map with configuration after the test symbol, example:

    (deftest async-test
      (wa/async-test
        {::wa/timeout 5000} ; 5000ms timeout
        (is (= 42 (<! (some-async-op)))))
sourceraw docstring

catch-allcljmacro

(catch-all & body)

Catches all Throwable exceptions and returns them as-is.

Catches all Throwable exceptions and returns them as-is.
sourceraw docstring

chan?clj

(chan? c)

Check if c is a core.async channel.

Check if c is a core.async channel.
sourceraw docstring

deftest-asynccljmacro

(deftest-async sym & body)

Define an async test, this helper uses the clojure.test async feature, the user body will be wrapped around a go block automatically and the async done will be called after the go block finishes it's execution. Example:

(wa/deftest-async async-test
  (is (= 42 (<! (some-async-op))))

This will also add a timeout (default 2000ms), to change the timeout you can send a map with configuration after the test symbol, example:

(wa/deftest-async async-test
  {::wa/timeout 5000} ; 5000ms timeout
  (is (= 42 (<! (some-async-op))))

If you want to use this with a different deftest constructor, use the async-test macro.

Define an async test, this helper uses the clojure.test async feature, the user body
will be wrapped around a `go` block automatically and the async done will be called
after the go block finishes it's execution. Example:

    (wa/deftest-async async-test
      (is (= 42 (<! (some-async-op))))

This will also add a timeout (default 2000ms), to change the timeout you can send
a map with configuration after the test symbol, example:

    (wa/deftest-async async-test
      {::wa/timeout 5000} ; 5000ms timeout
      (is (= 42 (<! (some-async-op))))

If you want to use this with a different `deftest` constructor, use the `async-test`
macro.
sourceraw docstring

error?clj

(error? err)

Returns true if err is an error object.

Returns true if err is an error object.
sourceraw docstring

gocljmacro

(go & body)

Same as clojure.core.async/go. Just a convenience place for it.

Same as `clojure.core.async/go`. Just a convenience place for it.
sourceraw docstring

go-catchcljmacro

(go-catch & body)

Creates a go block that has a try/catch wrapping body, in case of errors the error flows up as data instead triggering the exception.

Creates a go block that has a try/catch wrapping body, in case of errors the error
flows up as data instead triggering the exception.
sourceraw docstring

go-loopcljmacro

(go-loop bindings & body)

Same as clojure.core.async/go-loop. Just a convenience place for it.

Same as `clojure.core.async/go-loop`. Just a convenience place for it.
sourceraw docstring

go-promisecljmacro

(go-promise & body)

Creates a go block using a promise channel, so the output of the go block can be read any number of times once ready.

Creates a go block using a promise channel, so the output of the go block can be
read any number of times once ready.
sourceraw docstring

go-try-streamcljmacro

(go-try-stream & args)

If you want to read from a stream and catch errors in the messages that come from it, this helper is for you.

The complication around adding try-catch on a go-loop is that we can't recur inside try/catch. This helper will create a structure around it that will catch errors and recur properly.

Usage:

(go-try-stream [value some-chan]
  (do-operation-here)
  (catch Throwable e
    (report-error e))
If you want to read from a stream and catch errors in the messages that come
from it, this helper is for you.

The complication around adding try-catch on a go-loop is that we can't recur inside
try/catch. This helper will create a structure around it that will catch errors and recur
properly.

Usage:

    (go-try-stream [value some-chan]
      (do-operation-here)
      (catch Throwable e
        (report-error e))
sourceraw docstring

let-chancljmacro

(let-chan [name value] & body)

Handles a possible channel on value.

Handles a possible channel on value.
sourceraw docstring

let-chan*cljmacro

(let-chan* [name value] & body)

Like let-chan, but async errors will be returned instead of propagated

Like let-chan, but async errors will be returned instead of propagated
sourceraw docstring

nil-safe-put!cljmacro

(nil-safe-put! ch & body)

Puts result of body on the provided channel if non-nil, else it closes it. A workaround to allow communicating nils.

Puts result of body on the provided channel if non-nil, else it closes it.
A workaround to allow communicating nils.
sourceraw docstring

pulling-retrycljmacro

(pulling-retry options & body)

Async pulling mechanism that will run body will ::done? is satisfied.

There two ways to call this helper: Shorthand version: pass the ::done? function and the body:

(wa/pulling-retry int? (do-something))

Or the full version to specify all details

(wa/pulling-retry {::wa/done? int?
                   ::wa/retry-ms 50
                   ::wa/timeout 3000}
  (do-something))
Async pulling mechanism that will run body will ::done? is satisfied.

There two ways to call this helper:
  Shorthand version: pass the ::done? function and the body:

    (wa/pulling-retry int? (do-something))

  Or the full version to specify all details

    (wa/pulling-retry {::wa/done? int?
                       ::wa/retry-ms 50
                       ::wa/timeout 3000}
      (do-something))
sourceraw docstring

pulling-retry*clj

(pulling-retry* options f)
source

threadcljmacro

(thread & body)

Same as clojure.core.async/thread. Just a convenience place for it.

Same as `clojure.core.async/thread`. Just a convenience place for it.
sourceraw docstring

thread-catchcljmacro

(thread-catch & body)

Creates a thread that has a try/catch wrapping body, in case of errors the error flows up as data instead triggering the exception.

Creates a thread that has a try/catch wrapping body, in case of errors the error
flows up as data instead triggering the exception.
sourceraw docstring

thread-promisecljmacro

(thread-promise & body)

Creates a thread using a promise channel, so the output of the thread block can be read any number of times once ready.

Creates a thread using a promise channel, so the output of the thread block can be
read any number of times once ready.
sourceraw docstring

throw-errclj

(throw-err x)

Throw error x if x is an error.

Throw error x if x is an error.
sourceraw docstring

timeout-chanclj

(timeout-chan timeout-ms c)

Returns a channel that will respond will c, or an error after timeout-ms.

Returns a channel that will respond will c, or an error after timeout-ms.
sourceraw docstring

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

× close