This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-08-18
Channels
- # announcements (17)
- # babashka (42)
- # beginners (34)
- # calva (78)
- # cherry (1)
- # cider (7)
- # clojure (64)
- # clojure-europe (19)
- # clojure-nl (2)
- # clojure-norway (54)
- # clojure-uk (3)
- # clojurescript (21)
- # cloverage (1)
- # conjure (1)
- # core-async (11)
- # cryogen (16)
- # cursive (1)
- # data-oriented-programming (1)
- # datahike (5)
- # fulcro (2)
- # girouette (1)
- # helix (10)
- # hyperfiddle (1)
- # jobs (1)
- # kaocha (4)
- # nbb (7)
- # off-topic (6)
- # pathom (4)
- # polylith (21)
- # rdf (9)
- # releases (2)
- # shadow-cljs (3)
- # sql (12)
- # squint (68)
- # vim (33)
- # xtdb (29)
I am looking for @(promise)
but for nbb, i.e. I have a script that should not finish. Concretely I have a script that waits on changes to the clipboard, executing actions on its content, that should never finish on it's own.
How would I do that in nbb? In bb I'd add @(promise)
at the end of the script...
@steffenglueckselig I don't know what the idiomatic node solution is but something like this might work:
$ nbb -e '(defn wait [] (js/Promise. (fn [resolve reject] (js/setTimeout #(do (resolve) (wait) 10000000))))) (wait)'
What it does: every 10000
seconds it resolves a promise but starts waiting for a new one...🙏 1
directly translating await new Promise(() => {});
doesnt seem to work with nbb -e '(nbb.core/await (js/Promise. #()))'
but works in the repl
It does work in a script, though. Thanks!
nice! 😄