prex-es5
Version:
Async coordination primitives and extensions on top of ES6 Promises
36 lines (34 loc) • 1.25 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 AutoResetEvent {
private _signaled;
private _waiters;
/**
* Initializes a new instance of the AutoResetEvent class.
*
* @param initialState A value indicating whether to set the initial state to signaled.
*/
constructor(initialState?: boolean);
/**
* Sets the state of the event to signaled, resolving one or more waiting Promises.
* The event is then automatically reset.
*/
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>;
}