1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | import { CancellationToken } from "./cancellation";
|
8 | import { Cancelable } from "@esfx/cancelable";
|
9 |
|
10 |
|
11 |
|
12 | export declare class CountdownEvent {
|
13 | private _initialCount;
|
14 | private _remainingCount;
|
15 | private _event;
|
16 | |
17 |
|
18 |
|
19 |
|
20 |
|
21 | constructor(initialCount: number);
|
22 | /**
|
23 | * Gets the number of signals initially required to set the event.
|
24 | */
|
25 | get initialCount(): number;
|
26 | /**
|
27 | * Gets the number of remaining signals required to set the event.
|
28 | */
|
29 | get remainingCount(): number;
|
30 | /**
|
31 | * Increments the event's current count by one or more.
|
32 | *
|
33 | * @param count An optional count specifying the additional number of signals for which the event will wait.
|
34 | */
|
35 | add(count?: number): void;
|
36 | /**
|
37 | * Resets the remaining and initial count to the specified value, or the initial count.
|
38 | *
|
39 | * @param count An optional count specifying the number of required signals.
|
40 | */
|
41 | reset(count?: number): void;
|
42 | /**
|
43 | * Registers one or more signals with the CountdownEvent, decrementing the remaining count.
|
44 | *
|
45 | * @param count An optional count specifying the number of signals to register.
|
46 | */
|
47 | signal(count?: number): boolean;
|
48 | /**
|
49 | * Asynchronously waits for the event to become signaled.
|
50 | *
|
51 | * @param token An optional CancellationToken used to cancel the request.
|
52 | */
|
53 | wait(token?: CancellationToken | Cancelable): Promise<void>;
|
54 | }
|