@aws-amplify/auth
Version:
Auth category of aws-amplify
15 lines (11 loc) • 413 B
text/typescript
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
const inflightPromises: ((value: void | PromiseLike<void>) => void)[] = [];
export const addInflightPromise = (resolver: () => void) => {
inflightPromises.push(resolver);
};
export const resolveAndClearInflightPromises = () => {
while (inflightPromises.length) {
inflightPromises.pop()?.();
}
};