You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and central to supporting reactive programming in Perl 6.
16
16
17
-
18
17
There are two types of Supplies: C<live> and C<on demand>. When tapping into a
19
18
C<live> supply, the tap will only see values that are flowing through the
20
19
supply B<after> the tap has been created. Such supplies are normally infinite
@@ -29,7 +28,7 @@ time it is tapped. If the tap is closed, the timer simply stops emitting values
29
28
to that tap.
30
29
31
30
A C<live>C<Supply> is obtained from the L<Supplier|/type/Supplier>
32
-
factory method C<Supply>. New values are emitted by calling C<emit> on
31
+
factory method C<Supply>. New values are emitted by calling C<emit> on
33
32
the C<Supplier> object.
34
33
35
34
my $supplier = Supplier.new;
@@ -60,13 +59,9 @@ Creates a new tap (a kind of subscription if you will), in addition to all
60
59
existing taps. The first positional argument is a piece of code that will be
61
60
called when a new value becomes available through the C<emit> call.
62
61
63
-
The C<&done> callback is called when the C<done> method on the supply is
64
-
called, indicating the end of life of the channel. For a C<live> supply the
65
-
C<done> routine will be called on the parent C<Supplier>.
62
+
The C<&done> callback can be called in a number of cases: if a supply block is being tapped, when a C<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 C<&done> method is called on the parent C<Supplier> (in the case of a supply block, if there are multiple Suppliers referenced by C<whenever>, they must all have their C<done> method invoked for this to trigger the C<&done> callback of the tap).
66
63
67
-
The C<&quit> callback is called when the C<quit> method on the supply is
68
-
called, indicating an erroneous termination of the supply. For a C<live>
69
-
supply the C<quit> routine will be called on the parent C<Supplier>
64
+
The C<&quit> callback is called if the tap is on a supply block which exits with an error. It is also called if the C<quit> method is invoked on the parent C<Supplier> (in the case of a supply block any one C<Supplier> quitting with an uncaught exception will call the C<&quit> callback as the block will exit with an error).
70
65
71
66
Method C<tap> returns an object of type L<Tap|/type/Tap>, on which you can
72
67
call the C<close> method to cancel the subscription.
0 commit comments