@@ -14,7 +14,6 @@ It is a thread-safe implementation of the
14
14
L < Observer Pattern|https://en.wikipedia.org/wiki/Observer_pattern > ,
15
15
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,17 @@ 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 > .
66
-
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 >
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;
63
+ if a supply block is being tapped, it will be automatically triggered if the supply block reaches the end;
64
+ if the C < done > method is called on the parent C < Supplier >
65
+ (in the case of a supply block, if there are multiple Suppliers referenced by C < whenever > , they must
66
+ all have their C < done > method invoked for this to trigger the C < &done > callback of the tap as the
67
+ block will then reach its end).
68
+
69
+ The C < &quit > callback is called if the tap is on a supply block which exits with an error. It is also
70
+ called if the C < quit > method is invoked on the parent C < Supplier > (in the case of a supply block any
71
+ one C < Supplier > quitting with an uncaught exception will call the C < &quit > callback as the block will
72
+ exit with an error).
70
73
71
74
Method C < tap > returns an object of type L < Tap|/type/Tap > , on which you can
72
75
call the C < close > method to cancel the subscription.
0 commit comments