A simple listener interface, to be used in observer pattern
implementations or for specifying asynchronous callbacks.
This interface does not provide any usage contract or
assumptions on how the onValue(a) function gets called.
It's a replacement for Function1[A,Unit] but it does
not inherit from it, precisely because we want to attach
Listener semantics to types that cannot be Function1[A,Unit].
In particular monix.eval.Callback is a supertype of
Listener, even though Callback is a Try[A] => Unit.
A simple listener interface, to be used in observer pattern implementations or for specifying asynchronous callbacks.
This interface does not provide any usage contract or assumptions on how the
onValue(a)
function gets called.It's a replacement for
Function1[A,Unit]
but it does not inherit from it, precisely because we want to attachListener
semantics to types that cannot beFunction1[A,Unit]
.In particular
monix.eval.Callback
is a supertype ofListener
, even thoughCallback
is aTry[A] => Unit
.