Back
>! (clj)
(source)function
(>! port val)
puts a val into port. nil values are not allowed. Must be called
inside a (go ...) block. Will park if no buffer space is available.
Returns true unless port is already closed.
Examples
clojure/core.typed
buffer
use buffer> (similar for other buffer constructors)
"}
^:no-doc
clojure.core.typed.lib.cljs.core.async
(:require-macros [cljs.core.typed :refer [ann ann-datatype def-alias ann-protocol inst
tc-ignore]
:as t])
(:require [cljs.core.typed :refer [AnyInteger Seqable]]
[cljs.core.async]))
(ann ^:no-check cljs.core.async/chan (All [x]
(Fn [-> (Chan x)]
[(U (Buffer x) AnyInteger) -> (Chan x)])))
;(ann clojure.core.async/>! (All [x] [(Chan x) -> (Chan x)]))
(ann ^:no-check cljs.core.async/<!! (All [x] [(ReadOnlyPort x) -> (U nil x)]))
(ann ^:no-check cljs.core.async/>!! (All [x] [(WriteOnlyPort x) x -> nil]))
(ann ^:no-check cljs.core.async/alts!!
(All [x d]
(Fn [(Seqable (U (Port x) '[(Port x) x])) (Seqable (Port x)) & :mandatory {:default d} :optional {:priority (U nil true)} ->
(U '[d ':default] '[(U nil x) (Port x)])]
[(Seqable (U (Port x) '[(Port x) x])) & :optional {:priority (U nil true)} -> '[(U nil x) (Port x)]])))
dvcrn/markright
(ns markright.parser
(:require-macros [cljs.core.async.macros :refer [go]])
(:require [om.next :as om :refer-macros [defui]]
[electron.ipc :as ipc]
[cljs.core.async :as async :refer [chan put! pub sub unsub]]))
(defmethod ipc/process-cast :set-saved-content
[{:keys [content]}]
(go (>! root-channel #(om/transact! % `[(app/reset-saved-text)]))))
typedclojure/typedclojure
buffer
use buffer> (similar for other buffer constructors)
"}
^:no-doc
typed.lib.cljs.core.async
(:require-macros [cljs.core.typed :refer [ann ann-datatype defalias ann-protocol inst
tc-ignore]
:as t])
(:require [cljs.core.typed :refer [AnyInteger Seqable]]
[cljs.core.async]))
(ann ^:no-check cljs.core.async/chan (All [x]
(Fn [-> (Chan x)]
[(U (Buffer x) AnyInteger) -> (Chan x)])))
;(ann clojure.core.async/>! (All [x] [(Chan x) -> (Chan x)]))
(ann ^:no-check cljs.core.async/<!! (All [x] [(ReadOnlyPort x) -> (U nil x)]))
(ann ^:no-check cljs.core.async/>!! (All [x] [(WriteOnlyPort x) x -> nil]))
(ann ^:no-check cljs.core.async/alts!!
(All [x d]
(Fn [(Seqable (U (Port x) '[(Port x) x])) (Seqable (Port x)) & :mandatory {:default d} :optional {:priority (U nil true)} ->
(U '[d ':default] '[(U nil x) (Port x)])]
[(Seqable (U (Port x) '[(Port x) x])) & :optional {:priority (U nil true)} -> '[(U nil x) (Port x)]])))
nvbn/textarea-to-code-editor
(ns textarea-to-code-editor.content.handlers
(:require-macros [cljs.core.async.macros :refer [go]]
[textarea-to-code-editor.macros :refer [defhandler]])
(:require [cljs.core.match :refer-macros [match]]
[cljs.core.async :refer [>!]]
[textarea-to-code-editor.content.editor :as e]))
(defhandler populate-context-menu!
"Populates context menu with available modes."
[el runtime-chan]
(go (>! runtime-chan [:populate-context-menu
{:current-mode (e/get-editor-mode el)
:modes (e/get-modes)}]))
el)
(defhandler clear-context-menu!
"Clears context menu."
[runtime-chan]
(go (>! runtime-chan [:clear-context-menu nil]))
nil)
finnishtransportagency/harja
(ns harja.tiedot.hallinta.jms-jonot
(:require [tuck.core :as t :refer [process-event]]
[reagent.core :refer [atom]]
[cljs.core.async :refer [<! >! timeout chan alts!]]
[harja.tyokalut.tuck :as tuck-tyokalut])
(:require-macros [cljs.core.async.macros :refer [go go-loop]]))
(extend-protocol t/Event
HaeJMSnTila
(process-event [{:keys [jarjestelma]} tila]
(tuck-tyokalut/get! tila
(case jarjestelma
:itmf :hae-itmfn-tila)
{:onnistui ->JMSnTilaHaettu
:epaonnistui ->JMSnTilahakuEpaonnistui
:onnistui-parametrit [jarjestelma]
:epaonnistui-parametrit [jarjestelma]}))
AloitaJMSTilanHakeminen
(process-event [{:keys [jarjestelma]} tila]
(let [lopetus-kanava (chan)]
(t/action! (fn [e!]
(go-loop []
(e! (->HaeJMSnTila jarjestelma))
;; Jos ei ole tullut haun lopetus käskyä, haetaan tulokset 5 sek välein
(when-not (first (alts! [lopetus-kanava (timeout 5000)]))
(recur)))))
(assoc-in tila [:lopetus-kanava jarjestelma] lopetus-kanava)))
LopetaJMSTilanHakeminen
(process-event [{:keys [jarjestelma]} {lopetus-kanava :lopetus-kanava :as tila}]
(go (>! (get lopetus-kanava jarjestelma) true))
tila)
JMSnTilaHaettu
(process-event [{:keys [vastaus jarjestelma]} tila]
(assoc-in tila [:jarjestelmien-tilat jarjestelma] vastaus))
JMSnTilahakuEpaonnistui
(process-event [{:keys [vastaus jarjestelma]} tila]
(assoc-in tila [:jarjestelmien-virheet jarjestelma] vastaus)))