UNPKG

@lion/form-core

Version:

Form-core contains all essential building blocks for creating form fields and fieldsets

22 lines (21 loc) 640 B
/** * Use the `.add` method to add async functions to the queue * Await the `.complete` if you want to ensure the queue is empty at any point * `complete` resolves whenever no more tasks are running. * Important note: Currently runs tasks 1 by 1, there is no concurrency option at the moment */ export class AsyncQueue { __running: boolean; /** @type {function[]} */ __queue: Function[]; /** * * @param {function} task */ add(task: Function): void; complete: Promise<any> | undefined; /** @type {function} */ __callComplete: Function | undefined; /** @private */ private __run; }