This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-11-14
Channels
- # adventofcode (6)
- # announcements (4)
- # babashka (11)
- # beginners (18)
- # cider (7)
- # clj-kondo (4)
- # clj-on-windows (32)
- # clojars (6)
- # clojure-doc (1)
- # clojure-europe (14)
- # clojure-sg (1)
- # clojurescript (24)
- # conjure (4)
- # cursive (14)
- # datomic (2)
- # events (2)
- # graphql (5)
- # meander (6)
- # missionary (10)
- # nextjournal (6)
- # off-topic (10)
- # pathom (2)
- # pedestal (1)
- # practicalli (1)
- # re-frame (8)
- # reagent (3)
- # releases (1)
- # sci (6)
- # shadow-cljs (10)
- # spacemacs (4)
- # vim (6)
- # xtdb (9)
Hey folks, I’ve been looking for alternative ways of handling async code so this caught my attention. The docs suggest that this library works with clojurescript but, in my experience, none of the examples (tutorials) work on the javascript side. I understand that JS has thread limitations, so I’m looking for examples that navigate through these limitations... How do I use this if I’m targeting JS?
Everything works the same in js except ?
outside sp
/`ap`, and via
. In practice the only difference should be the entry point - run your main task with plain callbacks, or pass it to the promise constructor
Hi @leonoel, thanks for your time!
So I tried it with my typical callback mechanism the go
block, but it still fails:
(ns script.play
(:require-macros [cljs.core.async.macros :refer [go]])
(:require [missionary.core :as m]
[cljs.core.async :refer [<!]]))
(def nap (m/sleep 1000))
(def slowmo-hello-world
(m/sp (println "Hello")
(m/? nap)
(println "World")
(m/? nap)
(println "!")))
(go (let [res (<! (m/? slowmo-hello-world))]
(nil? res)))
Am I missing something obvious?
this correlation was super helpful!