Asynchronous implementation of the Observable interface
The Observer from the Rx pattern is the trio of callbacks that get subscribed to an Observable for receiving events.
Cancelables represent asynchronous units of work or other things scheduled for execution and whose execution can be canceled.
Cancelables represent asynchronous units of work or other things scheduled for execution and whose execution can be canceled.
One use-case is the scheduling done by monifu.concurrent.Scheduler, in which
the scheduling methods return a Cancelable
, allowing the canceling of the
scheduling.
Example:
val s = ConcurrentScheduler() val task = s.scheduleRepeated(10.seconds, 50.seconds, { println("Hello") }) // later, cancels the scheduling ... task.cancel()
The Observer from the Rx pattern is the trio of callbacks that get subscribed to an Observable for receiving events.
The events received must follow the Rx grammar, which is: onNext * (onComplete | onError)?
That means an Observer can receive zero or multiple events, the stream ending either in one or zero
onComplete
oronError
(just one, not both), and after onComplete or onError, a well behaved Observable implementation shouldn't send any more onNext events.