A promise library & concurrency toolkit for Clojure and ClojureScript.
This library exposes a bunch of useful syntactic abstractions that considerably simplify working with promises (in a very similar way as you will do it in JS with async/await) and many helpers from executors to concurrency patterns (bulkhead & CSP). With 0 runtime external dependencies.
Here you can look a detailed documentation.
deps.edn:
funcool/promesa {:mvn/version "11.0.678"}Or you can try the latest RC:
funcool/promesa {:mvn/version "12.0.0-RC2"}You also can get it via git:
funcool/promesa
{:git/sha "f152066"
:git/tag "12.0.0-RC2"
:git/url "https://github.com/funcool/promesa"}(require '[promesa.core :as p])
(->> (p/promise 1)
(p/map inc)
(deref)
;; => 2NOTE: example only work on JVM because the evident lack of blocking primitives on JS runtime.
If you miss something, feel free to open an issue for a discussion. If there is a clear use case for the proposed enhancement, the PR will be more than welcome.
Run the Clojure (.clj) tests:
clojure -M:dev -m promesa.tests.mainRun the ClojureScript (.cljs) tests:
corepack enable
corepack install
yarn install
yarn run testRun the Babashka tests:
bb test:bb