Liking cljdoc? Tell your friends :D

cljs-async

This is a library for asynchronous programming in ClojureScript based on native JavaScript promises.

Besides basic functions to create and work with promises, which correspond to the standardised JavaScript Promise API, this library contains an async macro that resembles async functions in JavaScript, and functions that simplify writing asynchronous tests with cljs.test.

The library is released on Clojars.

The generated API docs are available on cljdoc.

Usage

Primitive promises can be created with promise:

(core/promise
  (fn [resolve reject]
     ...some asynchronous operation...
	 (resolve :result)))

To compose promises, the async macro is the most comfortable:

(core/async
  (let [v (core/await some-promise)
        w (core/await some-other-promise)]
    (* v w)))

License

Copyright © 2020 Active Group GmbH

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

Can you improve this documentation?Edit on GitHub

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

× close