(event-onto-ch emitter out event)
(event-onto-ch emitter out event cb)
Converts a event cb into a core.async put!. Event Cb params are put into vectors. cb() -> [:event nil] cb(a) -> [:event [a]] cb(a,b) -> [:event [a b]] @param {!events.EventEmitter} emitter @param {!Channel} out :: unblocking buffers will drop data, including errors @param {!string} event @return {!events.EventEmitter}
Converts a event cb into a core.async put!. Event Cb params are put into vectors. cb() -> [:event nil] cb(a) -> [:event [a]] cb(a,b) -> [:event [a b]] @param {!events.EventEmitter} emitter @param {!Channel} out :: unblocking buffers will drop data, including errors @param {!string} event @return {!events.EventEmitter}
(go-proc in handler)
(go-proc in handler error-handler)
(go-proc in handler error-handler exit-cb)
(go-proc in handler error-handler exit-cb exit?)
Sets up an infinite go-loop with a kill method. Continuously takes from in and applies supplied handler to the read value asynchronously. If killed or input closes, exits the loop, and calls the supplied exit cb. If (exit? (<! in)) the go-proc is killed, though that same val is handled + events may still be processed depending on next round of alts!. The error handler should be a function of 1 arg and is called with errors from handler+exit? applications to incoming values. The go-proc will continue processing after errors & must be manually killed.
Sets up an infinite go-loop with a kill method. Continuously takes from _in_ and applies supplied handler to the read value asynchronously. If killed or input closes, exits the loop, and calls the supplied exit cb. If (exit? (<! in)) the go-proc is killed, though that same val is handled + events may still be processed depending on next round of alts!. The error handler should be a function of 1 arg and is called with errors from handler+exit? applications to incoming values. The go-proc will continue processing after errors & must be manually killed.
(admux this port)
add a Readport to the Mux
add a Readport to the Mux
(unmux this port)
remove a Readport from the Mux
remove a Readport from the Mux
(unmux-all this)
remove all ports from Mux reading
remove all ports from Mux reading
(mux handler)
(mux handler err-handler)
Inspired by core.async/mix, mux is a 'multiplex' of readports. Instead of building a mix and then having a separate consumption and processing step, this skips the middle-man and continuously processes values from a collection of ReadPorts using the given handler. This saves an extra chan+go-loop and skips unecessary asynchronicity. It can be view as an extensible border between asynchronous data reception and synchronous handling of that data (though there is no reason you cannot reintroduce asynchronicity downstream).
Added ReadPorts are continually read from using a shared alts! go-loop, and the user supplied handler is called with the port & recieved values. When a port closes, it is removed from the mux. An empty mux will persist until killed. Mux knows nothing about msg content or ReadPorts' lifecycle.
Mux is meant to serve as an entry point for external connections into your application. Structure your input values and handler fn for data based routing @return {!IMux}
Inspired by core.async/mix, mux is a 'multiplex' of readports. Instead of building a mix and then having a separate consumption and processing step, this skips the middle-man and continuously processes values from a collection of ReadPorts using the given handler. This saves an extra chan+go-loop and skips unecessary asynchronicity. It can be view as an *extensible* border between asynchronous data reception and synchronous handling of that data (though there is no reason you cannot reintroduce asynchronicity downstream). Added ReadPorts are continually read from using a shared alts! go-loop, and the user supplied handler is called with the port & recieved values. When a port closes, it is removed from the mux. An empty mux will persist until killed. Mux knows nothing about msg content or ReadPorts' lifecycle. Mux is meant to serve as an entry point for external connections into your application. Structure your input values and handler fn for data based routing @return {!IMux}
(readable-onto-ch rstream out-ch)
(readable-onto-ch rstream out-ch events)
Generic interface so you can write reloadable handlers. Removes the need to manage stream listener reload lifecycle. Supply your configured chan. 'data', 'end', & 'error' events are caught and put! as [:event [cb-arg0 cb-arg1]].
If your stream fires other events (such as 'close'), provide them as a vector of strings. 'close' is automatically recognized as an exit condition. The chan will be closed when exit conditions have been met.
Be aware that nonblocking buffers may drop error events too. Parking chans behave just like stream.pipe methods. Note pending put! limits @return {!cljs.core.async.impl.protocols/Channel}
Generic interface so you can write reloadable handlers. Removes the need to manage stream listener reload lifecycle. Supply your configured chan. 'data', 'end', & 'error' events are caught and put! as [:event [cb-arg0 cb-arg1]]. If your stream fires other events (such as 'close'), provide them as a vector of strings. 'close' is automatically recognized as an exit condition. The chan will be closed when exit conditions have been met. Be aware that nonblocking buffers may drop error events too. Parking chans behave just like stream.pipe methods. Note pending put! limits @return {!cljs.core.async.impl.protocols/Channel}
(server->ch server)
(server->ch server buf-or-n)
(sock->ch socket)
(sock->ch socket buf-or-n)
[:data [chunk]] [:error [js/Error]] [:connect nil] [:close [?js/Error]] [:drain nil] [:lookup [?js/Error address ?family host]] [:timeout nil] [:end nil]
[:data [chunk]] [:error [js/Error]] [:connect nil] [:close [?js/Error]] [:drain nil] [:lookup [?js/Error address ?family host]] [:timeout nil] [:end nil]
(writable-onto-ch wstream out-ch)
(writable-onto-ch wstream out-ch events)
Generic interface so you can write reloadable handlers. Removes the need to manage stream listener reload lifecycle. Supply your configured chan. 'finish', 'drain', & 'error' events are caught and put! as [:event [cb-arg0 cb-arg1]].
If your stream fires other events (such as 'close'), provide them as a vector of strings. 'close' is automatically recognized as an exit condition. The chan will be closed when exit conditions have been met.
Be aware that nonblocking buffers may drop error events too. Parking chans behave just like stream.pipe methods. Note pending put! limits @return {!cljs.core.async.impl.protocols/Channel}
Generic interface so you can write reloadable handlers. Removes the need to manage stream listener reload lifecycle. Supply your configured chan. 'finish', 'drain', & 'error' events are caught and put! as [:event [cb-arg0 cb-arg1]]. If your stream fires other events (such as 'close'), provide them as a vector of strings. 'close' is automatically recognized as an exit condition. The chan will be closed when exit conditions have been met. Be aware that nonblocking buffers may drop error events too. Parking chans behave just like stream.pipe methods. Note pending put! limits @return {!cljs.core.async.impl.protocols/Channel}
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close