UNPKG

1.41 kBTypeScriptView Raw
1/*! *****************************************************************************
2Copyright (c) Microsoft Corporation.
3Licensed under the Apache License, Version 2.0.
4
5See LICENSE file in the project root for details.
6***************************************************************************** */
7import { CancellationToken } from "./cancellation";
8import { Cancelable } from "@esfx/cancelable";
9/**
10 * Asynchronously notifies one or more waiting Promises that an event has occurred.
11 */
12export declare class ManualResetEvent {
13 private _signaled;
14 private _waiters;
15 /**
16 * Initializes a new instance of the ManualResetEvent class.
17 *
18 * @param initialState A value indicating whether to set the initial state to signaled.
19 */
20 constructor(initialState?: boolean);
21 /**
22 * Gets a value indicating whether the event is signaled.
23 */
24 get isSet(): boolean;
25 /**
26 * Sets the state of the event to signaled, resolving one or more waiting Promises.
27 */
28 set(): void;
29 /**
30 * Sets the state of the event to nonsignaled, causing asynchronous operations to pause.
31 */
32 reset(): void;
33 /**
34 * Asynchronously waits for the event to become signaled.
35 *
36 * @param token A CancellationToken used to cancel the request.
37 */
38 wait(token?: CancellationToken | Cancelable): Promise<void>;
39}