-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIWaitable.php
More file actions
30 lines (26 loc) · 874 Bytes
/
Copy pathIWaitable.php
File metadata and controls
30 lines (26 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
namespace Srdestino\Waitable;
interface IWaitable
{
/**
* It will pause execution until the Waitable is resolved (i.e., fulfilled or rejected),and to resume execution of
* the asynchronous function after fulfillment.
* When resumed it will return the value will be the value of the fullfilment.
*/
public function Wait();
/**
* Ends the waitable with a given value
* */
public function Resolve($value);
/**
* @param $err
* It will reject the waitable with the given error.
* It will notify all the callbacks added in then and will set the waitable as rejected.
*/
public function Reject($err);
/**
* @param IWaitable $waitable
* It will pause execution until all the Waitables are resolved (i.e., fulfilled or rejected)
*/
public static function WaitAll($waitList);
}