Liking cljdoc? Tell your friends :D

sci.impl.async-macro

Transforms async function bodies with await into Promise .then chains.

Supports await in:

  • let bindings: (let [x (await p)] ...)
  • do forms: (do (await p) ...)
  • arbitrary expressions: (inc (await p))
  • macros like -> are expanded first

Example: (defn ^:async foo [] (let [x (await (js/Promise.resolve 1))] (inc x)))

Transforms to: (defn foo [] (.then (js/Promise.resolve 1) (fn [x] (inc x))))

Transforms async function bodies with await into Promise .then chains.

Supports await in:
- let bindings: (let [x (await p)] ...)
- do forms: (do (await p) ...)
- arbitrary expressions: (inc (await p))
- macros like -> are expanded first

Example:
  (defn ^:async foo []
    (let [x (await (js/Promise.resolve 1))]
      (inc x)))

Transforms to:
  (defn foo []
    (.then (js/Promise.resolve 1) (fn [x] (inc x))))
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close