Liking cljdoc? Tell your friends :D
Clojure only.

conquerant.core


asynccljmacro

(async expr)

If expr is a fn or defn form, its body will run asyncronously. Otherwise, expr will itself run asyncronously, and return a CompletableFuture.

WARNING: all let blocks inside an async block return CompletableFutures.

All async exectution occurs on the ci/*executor* pool, which is bound to the common ForkJoinPool by default.

If `expr` is a `fn` or `defn` form, its body will
run asyncronously. Otherwise, `expr` will itself
run asyncronously, and return a `CompletableFuture`.

WARNING: *all* `let` blocks inside an `async` block
return `CompletableFuture`s.

All async exectution occurs on the `ci/*executor*` pool,
which is bound to the common ForkJoinPool by default.
sourceraw docstring

awaitclj

(await v)

Use inside async let blocks:

(async (let [x (async :x) y (await x)] y))

Will wait for the CompletableFuture to complete before evaluation resumes.

Use inside `async` `let` blocks:

(async
  (let [x (async :x)
        y (await x)]
    y))

Will wait for the `CompletableFuture` to complete
before evaluation resumes.
sourceraw docstring

promisecljmacro

(promise [resolve reject] & body)

Used to get values out of callbacks.

ex: ;; some fn that takes a callback (defn fetch [url callback] ...)

;; can be used as (let p (promise [res rej] (fetch "http://some.service.com" #(res %))))

Used to get values out of callbacks.

ex:
;; some fn that takes a callback
(defn fetch [url callback] ...)

;; can be used as
(let p
  (promise [res rej]
    (fetch "http://some.service.com"
           #(res %))))
sourceraw docstring

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

× close