Liking cljdoc? Tell your friends :D

app-sauce.async.worker


dispatchclj

(dispatch this value)

Sends a message to the worker. May block. Returns true if the value could be delivered to the worker's input channel.

Sends a message to the worker. May block. Returns true if the value could be
delivered to the worker's input channel.
raw docstring

injectclj

(inject this value)

Returns a promise with the result from the worker. May block. The value of the promise will be nil if the worker has already stopped.

Returns a promise with the result from the worker. May block. The value of
the promise will be nil if the worker has already stopped.
raw docstring

startclj

(start name-str initial-data callback)
(start name-str initial-data callback outbox)

Start a worker and return associated core.async channels. Work is received on an 'input' channel (:in) and results are sent to an 'output' channel (:out). See the dispatch and inject functions for different ways of interacting with the worker.

The caller can provide the output channel by specifying outbox. If there is no output consumer, pass nil for the outbox, so the worker will not get stuck attempting to send output.

The work is performed by the callback function. That function will be provided two arguments: the current version of data and the value that was sent to the input channel. The callback function must return a vector: nil no change in data and no output [new-data] new value for data but no output [new-data output-value] new value fordataand a value to output[new-data output1 output2] new value for data and multiple output values

Additionally, when inject is used, the first value after data will be the result returned to the promise: [new-data result] a result forinjectbut no output[new-data result output1 ...] a result for inject along with output values

The initial value of data should be passed as the initial-data parameter.

Start a worker and return associated core.async channels. Work is received
on an 'input' channel (`:in`) and results are sent to an 'output' channel
(`:out`). See the `dispatch` and `inject` functions for different ways of
interacting with the worker.

The caller can provide the output channel by specifying `outbox`. If there is
no output consumer, pass nil for the outbox, so the worker will not get stuck
attempting to send output.

The work is performed by the callback function. That function will be
provided two arguments: the current version of `data` and the value that was
sent to the input channel. The callback function must return a vector:
`nil`                        no change in `data` and no output
`[new-data]`                 new value for `data` but no output
`[new-data output-value]     new value for `data` and a value to output
`[new-data output1 output2]  new value for `data` and multiple output values

Additionally, when `inject` is used, the first value after `data` will be the
result returned to the promise:
`[new-data result]              a result for `inject` but no output
`[new-data result output1 ...]  a result for `inject` along with output values

The initial value of `data` should be passed as the `initial-data` parameter.
raw docstring

stop!clj

(stop! this)

Stops the worker thread and closes the associated channels.

Stops the worker thread and closes the associated channels.
raw docstring

unwrapclj

(unwrap msg)

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close