Transforms async function bodies with await into Promise .then chains.
Supports await in:
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))))cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |