/*! Copyright 2019 Ron Buckton Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. THIRD PARTY LICENSE NOTICE: AsyncQueue is derived from the implementation of Queue in Promise Extensions for Javascript: https://github.com/rbuckton/prex Promise Extensions is licensed under the Apache 2.0 License: Promise Extensions for JavaScript Copyright (c) Microsoft Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ import { Cancelable, CancelError } from "@esfx/cancelable"; /** * An async coordination primitive that provides a queue of Promises. */ export declare class WaitQueue { private _list; /** * Gets the number of pending entries in the queue. */ get size(): number; /** * Returns a `Promise` for the next value to be added to the queue. * @param cancelable A `Cancelable` used to cancel the request. */ wait(cancelable?: Cancelable): Promise; /** * Resolves a pending `wait()` operation with the provided value. * @returns `true` if a pending `wait()` operation was resolved; otherwise, `false`. */ resolveOne(this: WaitQueue): boolean; /** * Resolves a pending `wait()` operation with the provided value. * @returns `true` if a pending `wait()` operation was resolved; otherwise, `false`. */ resolveOne(value: T | PromiseLike): boolean; /** * Resolves all pending `wait()` operations with the provided value. * @returns The number of pending `wait()` operations that were resolved. */ resolveAll(this: WaitQueue): number; /** * Resolves all pending `wait()` operations with the provided value. * @returns The number of pending `wait()` operations that were resolved. */ resolveAll(value: T | PromiseLike): number; /** * Rejects the next pending `wait()` operation with the provided reason. * @returns `true` if a pending `wait()` operation was rejected; otherwise, `false`. */ rejectOne(reason: unknown): boolean; /** * Rejects all pending `wait()` operations with the provided reason. * @returns The number of pending `wait()` operations that were rejected. */ rejectAll(reason: unknown): number; /** * Rejects the next pending `wait()` operation with a `CancelError`. * @returns `true` if a pending `wait()` operation was rejected; otherwise, `false`. */ cancelOne(reason?: CancelError): boolean; /** * Rejects all pending `wait()` operations with a `CancelError`. * @returns The number of pending `wait()` operations that were rejected. */ cancelAll(reason?: CancelError): number; } //# sourceMappingURL=index.d.ts.map