Skip to content

Commit

Permalink
Implement Supply.share (on-demand => live).
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Dec 13, 2015
1 parent 236cd2e commit a342eb1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/core/Supply.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1355,6 +1355,15 @@ my class Supply {
}
}
}

method share(Supply:D:) {
my $sup = Supplier.new;
self.tap:
-> \msg { $sup.emit(msg) },
done => -> { $sup.done() },
quit => -> \ex { $sup.quit(ex) }
$sup.Supply
}
}

# A Supplier is a convenient way to create a live Supply. The publisher can
Expand Down

0 comments on commit a342eb1

Please sign in to comment.