Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add some documentation for promise methods
  • Loading branch information
kraih committed Oct 24, 2017
1 parent 96a5717 commit 21d79e5
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions lib/Mojo/IOLoop/Delay.pm
Expand Up @@ -350,6 +350,12 @@ implements the following new ones.
my $new = $delay->all(@delays);
Returns a new L<Mojo::IOLoop::Delay> object that either fulfills when all of the
passed L<Mojo::IOLoop::Delay> objects have fulfilled or rejects as soon as one
of them rejects. If the returned promise fulfills, it is fulfilled with the
values from the fulfilled promises in the same order as the passed promises.
This method can be useful for aggregating results of multiple promises.
=head2 begin
my $cb = $delay->begin;
Expand Down Expand Up @@ -404,6 +410,11 @@ together to the next step or L</"finish"> event.
my $new = $delay->catch(sub {...});
Appends a rejection handler callback to the promise, and returns a new
L<Mojo::IOLoop::Delay> object resolving to the return value of the callback if
it is called, or to its original fulfillment value if the promise is instead
fulfilled.
=head2 data
my $hash = $delay->data;
Expand All @@ -423,6 +434,10 @@ Data shared between all L</"steps">.
my $new = $delay->finally(sub {...});
Appends a fulfillment and rejection handler to the promise, and returns a new
L<Mojo::IOLoop::Delay> object resolving to the original fulfillment value or
rejection reason.
=head2 pass
$delay = $delay->pass;
Expand All @@ -438,13 +453,21 @@ next step.
my $new = $delay->race(@delays);
Returns a new L<Mojo::IOLoop::Delay> object that fulfills or rejects as soon as
one of the passed L<Mojo::IOLoop::Delay> objects fulfills or rejects, with the
value or reason from that promise.
=head2 reject
$delay = $delay->reject(@args);
$delay = $delay->reject(@results);
Reject the promise.
=head2 resolve
$delay = $delay->resolve(@args);
$delay = $delay->resolve(@results);
Resolve the promise.
=head2 steps
Expand All @@ -460,6 +483,10 @@ event counter or an exception gets thrown in a callback.
my $new = $delay->then(sub {...}, sub {...});
Appends fulfillment and rejection handlers to the promise, and returns a new
L<Mojo::IOLoop::Delay> object resolving to the return value of the called
handler.
=head2 wait
$delay->wait;
Expand Down

0 comments on commit 21d79e5

Please sign in to comment.