prex
Version:
Async coordination primitives and extensions on top of ES6 Promises
29 lines (27 loc) • 915 B
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";
import { Cancelable } from "@esfx/cancelable";
/**
* Asynchronously notifies one or more waiting Promises that an event has occurred.
*/
export declare class Pulsar {
private _waiters;
/**
* Notifies the next waiter.
*/
pulse(): void;
/**
* Notifies all waiters.
*/
pulseAll(): void;
/**
* Asynchronously waits for the the next pulse.
*
* @param token A CancellationToken used to cancel the request.
*/
wait(token?: CancellationToken | Cancelable): Promise<void>;
}