Documentation for method
tap assembled from the following types:
method tap(Supply: = -> $ ,: = -> ,: = -> ,: = -> $ )
Creates a new tap (a kind of subscription if you will), in addition to all existing taps. The first positional argument is a piece of code that will be called when a new value becomes available through the
&done callback can be called in a number of cases: if a supply block is being tapped, when a
done routine is reached; if a supply block is being tapped, it will be automatically triggered if the supply block reaches the end; if the
done method is called on the parent
Supplier (in the case of a supply block, if there are multiple Suppliers referenced by
whenever, they must all have their
done method invoked for this to trigger the
&done callback of the tap as the block will then reach its end).
&quit callback is called if the tap is on a supply block which exits with an error. It is also called if the
quit method is invoked on the parent
Supplier (in the case of a supply block any one
Supplier quitting with an uncaught exception will call the
&quit callback as the block will exit with an error). The error is passed as a parameter to the callback.
&tap callback is called once the Tap object is created, which is passed as a parameter to the callback. The callback is called ahead of
quit, providing a reliable way to get the
Tap object. One case where this is useful is when the
Supply begins emitting values synchronously, since the call to
.tap won't return the
Tap object until it is done emitting, preventing it from being stopped if needed.
tap returns an object of type Tap, on which you can call the
close method to cancel the subscription.
my = Supply.from-list(0 .. 5);my = .tap(-> , done => );
012345no more ticks