File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ Further examples can be found in the L<concurrency page|/language/concurrency#Su
53
53
method tap(Supply:D: &emit = -> $ { },
54
54
:&done,
55
55
:&quit,
56
+ :&tap
56
57
--> Tap:D)
57
58
58
59
Creates a new tap (a kind of subscription if you will), in addition to all
@@ -69,7 +70,14 @@ block will then reach its end).
69
70
The C < &quit > callback is called if the tap is on a supply block which exits with an error. It is also
70
71
called if the C < quit > method is invoked on the parent C < Supplier > (in the case of a supply block any
71
72
one C < Supplier > quitting with an uncaught exception will call the C < &quit > callback as the block will
72
- exit with an error).
73
+ exit with an error). The error is passed as a parameter to the callback.
74
+
75
+ The C < &tap > callback is called once the L < Tap|/type/Tap > object is created,
76
+ which is passed as a parameter to the callback. The callback is called ahead of
77
+ C < emit > /C < done > /C < quit > , providing a reliable way to get the C < Tap > object. One
78
+ case where this is useful is when the C < Supply > begins emitting values
79
+ synchronously, since the call to C < .tap > won't return the C < Tap > object until
80
+ it is done emitting, preventing it from being stopped if needed.
73
81
74
82
Method C < tap > returns an object of type L < Tap|/type/Tap > , on which you can
75
83
call the C < close > method to cancel the subscription.
You can’t perform that action at this time.
0 commit comments