Cached live Supply factory
This is a factory for live Supply-type objects, and it provides the mechanism for emitting new values onto the supplies, whereby values are kept when no consumer has tapped into the
Supply. Any tapping will consume the already stored and future values.
Starting a preserving
Supply and consuming its values after it is
my = Supplier::Preserving.new;start for ^3sleep 2;reactsay „also done after s“
done after 0.0638467s012also done after 4.0534119s
Supplier::Preserving inherits from class Supplier, which provides the following routines:
method Supply(Supplier: --> Supply)
This creates a new
Supply object to which any values which are emitted on this supplier are passed. This is the factory for all
method emit(Supplier: Mu \value)
Sends the given value to all of the taps on all of the supplies created by
Supply on this
done callback on all the taps that have one.
my = Supplier.new;my = .Supply;.tap(-> , done => );.emit(42);.done;
42no more answers
multi method quit(Supplier: Exception )multi method quit(Supplier: Str() )
This is meant for shutting down a supply with an error.