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...Maybe (nbb.core/await (js/Promise. #())) does it too?
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! 😄