Back

ManyToManyChannel (clj)

(source)

type

Examples

juxt/yada
(ns yada.async
  (:require
   [clojure.core.async :as a]
   [manifold.stream.async]
   [yada.body :refer [MessageBody to-body render-seq]])
  (:import
   [clojure.core.async Mult]
   [clojure.core.async.impl.channels ManyToManyChannel]
   [manifold.stream.async CoreAsyncSource]))

  ManyToManyChannel
  (to-body [ch representation] (render-seq ch representation))
  (content-length [_] nil))
athos/kitchen-async
(ns kitchen-async.promise.from-channel
  (:require [clojure.core.async :as a]
            [clojure.core.async.impl.channels :refer [ManyToManyChannel]]
            [kitchen-async.promise :as p]
            [kitchen-async.protocols.promisable :refer [Promisable]]))

(extend-protocol Promisable
  ManyToManyChannel
  (->promise* [c]
    (p/promise [resolve reject]
      (a/go
        (let [x (a/<! c)]
          (if (instance? js/Error x)
            (reject x)
            (resolve x)))))))
aaronc/fx-clj
(ns ^:no-doc fx-clj.core.convert
  (:require
    [fx-clj.core.extensibility :refer [convert-arg]]
    [fx-clj.util :as util]
    [clojure.core.async :refer [put!]]
    ;;[camel-snake-kebab.core :as csk]
    [org.tobereplaced.lettercase :as lettercase])
  (:import (javafx.event EventHandler)
           (clojure.core.async.impl.channels ManyToManyChannel)
           (javafx.util Callback)
           (javafx.collections ObservableList FXCollections)
           (javafx.scene Node)
           (javax.swing JComponent)
           (javafx.embed.swing SwingNode)
           (javafx.beans.property Property)
           (fx_clj.binding ReactiveAtomObservable)
           [freactive IReactiveAtom]))

(defmethod convert-arg [EventHandler ManyToManyChannel] [_ ch _]
  (util/event-handler [e] (put! ch e)))