Skip to content
This repository was archived by the owner on Jan 2, 2023. It is now read-only.

Commit b487b5e

Browse files
committed
async example
1 parent 8822c16 commit b487b5e

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

squint/corpus/async.cljs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
(ns async)
2+
3+
(defn ^:async status []
4+
(let [resp (js/await (js/fetch "https://clojure.org"))
5+
status (js/await (.-status resp))]
6+
status))
7+
8+
(def chalk (.-default (js/await (js/import "chalk"))))
9+
10+
(js/console.log "status:" (chalk.green (js/await (status))))

squint/corpus/async.mjs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
async function status () {
2+
return (await (async function () {
3+
return (await (async function () {
4+
const resp = (await fetch("https://clojure.org"));
5+
const status = (await resp["status"]);
6+
return (function () {
7+
return status;
8+
})();
9+
})());
10+
})());
11+
};
12+
const chalk = (await import("chalk"))["default"];
13+
console.log("status:", chalk.green((await status())));

squint/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
],
1010
"devDependencies": {
1111
"@vercel/ncc": "^0.34.0",
12-
"cherry-cljs": "."
12+
"cherry-cljs": ".",
13+
"chalk": "^5.0.1"
1314
}
1415
}

0 commit comments

Comments
 (0)