prex-es5
Version:
Async coordination primitives and extensions on top of ES6 Promises
39 lines (37 loc) • 1.31 kB
TypeScript
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Licensed under the Apache License, Version 2.0.
See LICENSE file in the project root for details.
***************************************************************************** */
import { CancellationToken } from "./cancellation";
/**
* Asynchronously notifies one or more waiting Promises that an event has occurred.
*/
export declare class ManualResetEvent {
private _signaled;
private _waiters;
/**
* Initializes a new instance of the ManualResetEvent class.
*
* @param initialState A value indicating whether to set the initial state to signaled.
*/
constructor(initialState?: boolean);
/**
* Gets a value indicating whether the event is signaled.
*/
readonly isSet: boolean;
/**
* Sets the state of the event to signaled, resolving one or more waiting Promises.
*/
set(): void;
/**
* Sets the state of the event to nonsignaled, causing asynchronous operations to pause.
*/
reset(): void;
/**
* Asynchronously waits for the event to become signaled.
*
* @param token A CancellationToken used to cancel the request.
*/
wait(token?: CancellationToken): Promise<void>;
}