@@ -188,12 +188,12 @@ consumed by one or more consumers simultaneously in a manner similar to
188
188
"events" in other programming languages and can be seem as enabling
189
189
"Event Driven" or reactive designs.
190
190
191
- L < Supply > is a role that can be composed into your own types, but will
191
+ L < Supply > is a role that can be composed into your own types, but will
192
192
frequently be used as a "type punned" class to create standalone objects.
193
193
194
194
At its simplest a L < Supply > is a message stream that can have multiple
195
195
subscribers created with the method C < tap > on to which data items can be
196
- placed with C < emit > :
196
+ placed with C < emit > :
197
197
198
198
my $supply = Supply.new();
199
199
@@ -214,25 +214,25 @@ interested in the events:
214
214
$supply.emit("Won't trigger the tap");
215
215
216
216
Calling C < close > on the L < Tap > object (or calling C < close > on the supply
217
- object with the tap object as an argument,) will trigger the callback
217
+ object with the tap object as an argument,) triggers the callback
218
218
specified by C < closing > if present and stop further events being sent to
219
219
the tap callback but otherwise leave the supply intact to receive further
220
- events. Calling C < done > on the supply object will similarly call the
221
- C < done > callback that may be specified for any taps but will not prevent any
220
+ events. Calling C < done > on the supply object similarly calls the
221
+ C < done > callback that may be specified for any taps, but does not prevent any
222
222
further events being emitted to the stream, or taps receiving them.
223
223
224
- The method C < interval > will return a new supply which will automatically
225
- emit a new event at the specified interval, the data that is emitted will
226
- be an integer starting at 0 that will be incremented for each event. The
227
- following code will output 0 .. 5 :
224
+ The method C < interval > returns a new supply which peridically
225
+ emits a new event at the specified interval. The data that is emitted
226
+ is an integer starting at 0 that is incremented for each event. The
227
+ following code outputs 0 .. 5 :
228
228
229
229
my $supply = Supply.interval(2);
230
230
$supply.tap(-> $v { say $v });
231
231
sleep 10;
232
232
233
- A second argument can be supplied which will specify a delay in seconds
233
+ A second argument can be supplied which specifies a delay in seconds
234
234
before the first event is fired. Each tap of a supply created by
235
- C < interval > will have its own sequence starting from 0, as illustrated
235
+ C < interval > has its own sequence starting from 0, as illustrated
236
236
by the following:
237
237
238
238
my $supply = Supply.interval(2);
@@ -244,8 +244,8 @@ by the following:
244
244
An existing supply object can be filtered or transformed, using the methods
245
245
C < grep > and C < map > respectively, to create a new supply in a manner like
246
246
the similarly named list methods: C < grep > returns a supply such that only
247
- those events emitted on the source stream for which the expression provided
248
- to the C < grep > will be enitted :
247
+ those events emitted on the source stream for which the C < grep > condition
248
+ is true is emitted on the second supply :
249
249
250
250
my $supply = Supply.new;
251
251
$supply.tap(-> $v { say "Original : $v" });
@@ -257,9 +257,9 @@ to the C<grep> will be enitted:
257
257
$supply.emit($_);
258
258
}
259
259
260
- C < map > will return a new supply such that for each item emitted to the
260
+ C < map > returns a new supply such that for each item emitted to the
261
261
original supply a new item which is the result of the expression passed
262
- to the C < map > will be emitted:
262
+ to the C < map > is emitted:
263
263
264
264
my $supply = Supply.new;
265
265
$supply.tap(-> $v { say "Original : $v" });
0 commit comments