Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Document type Tap
one of the few types we have covered completely, I believe :-)
  • Loading branch information
moritz committed Dec 22, 2014
1 parent d3311df commit 7d7d839
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Type/Supply.pod
Expand Up @@ -59,8 +59,8 @@ called, indicating an erroneous termination of the supply.
The C<&closing> callback is called when somebody closes the tap (which
terminates that subscription, but keeps the supply as a whole in tact).
Method C<tap> returns an object of type C<Tap>, on which you can call the
C<close> method to cancle the subscription.
Method C<tap> returns an object of type L<Tap|/type/Tap>, on which you can
call the C<close> method to cancle the subscription.
=head2 method emit
Expand Down
64 changes: 64 additions & 0 deletions lib/Type/Tap.pod
@@ -0,0 +1,64 @@
=begin pod
=TITLE class Tap
=SUBTITLE A subscription to a supply
class Tap { ... }
A Tap is a subscription to a L<Supply|/type/Supply>.
my $s = Supply.new;
my $tap = $s.tap(
-> $v { say "the value is $v" },
done => { say "Supply is done" },
closing => { say "Tap closed" },
quit => -> $ex { say "Supply finished with error $ex" },
);
# later
$tap.close;
# or
$s.close($tap);
=head1 Methods
=head2 method emit
method emit(Tap:D:) returns Callable:D
Returns the callback that is called for emitted events.
=head2 method done
method done(Tap:D:)
Returns the callback that is called on successfully shutting down a channel,
if any.
=head2 method quit
method quit(Tap:D:)
Returns the callback that is called on shutting down a channel with error, if
any.
=head2 method closing
method closing(Tap:D:)
Returns the callback that is called on closing the tap.
=head2 method supply
method supply(Tap:D:)
Returns the supply to which the tap belongs.
=head2 method close
method closing(Tap:D:)
Closes the tap.
=end pod

0 comments on commit 7d7d839

Please sign in to comment.