UNPKG

915 BTypeScriptView 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 Pulsar {
13 private _waiters;
14 /**
15 * Notifies the next waiter.
16 */
17 pulse(): void;
18 /**
19 * Notifies all waiters.
20 */
21 pulseAll(): void;
22 /**
23 * Asynchronously waits for the the next pulse.
24 *
25 * @param token A CancellationToken used to cancel the request.
26 */
27 wait(token?: CancellationToken | Cancelable): Promise<void>;
28}