This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-22
Channels
- # beginners (10)
- # boot (134)
- # cider (29)
- # clara (2)
- # cljs-dev (10)
- # cljsjs (2)
- # cljsrn (13)
- # clojure (76)
- # clojure-india (4)
- # clojure-ireland (1)
- # clojure-russia (20)
- # clojure-spec (11)
- # clojure-uk (7)
- # clojurescript (88)
- # core-async (5)
- # core-logic (3)
- # cursive (17)
- # datascript (5)
- # datomic (123)
- # hoplon (8)
- # klipse (6)
- # lambdaisland (2)
- # leiningen (4)
- # luminus (2)
- # off-topic (23)
- # om (23)
- # om-next (1)
- # onyx (20)
- # pedestal (2)
- # perun (2)
- # re-frame (11)
- # ring-swagger (3)
- # untangled (12)
> And that's a 1-time kind of thing but takers can take value many times
(require '[clojure.core.async :as a])
=> nil
(def ch (a/promise-chan))
=> #'user/ch
(a/put! ch 42)
=> true
(a/close! ch)
=> nil
(a/<!! ch)
=> 42
(a/<!! ch)
=> 42
(a/<!! ch)
=> 42
If I have a component
that consume the message from publication, when the component
start, a go-loop
will be start. If I want to stop the component
, I should send a special :msg-type
that stands for STOP signal?
@doglooksgood write a loop which exits if reading from channel returns nil
(or writing to channel returns false
)
then you can stop a loop by closing this channel
@doglooksgood using an atim works fine too.