UNPKG

@react-form-builder/core

Version:

React JSON Schema Form Builder to create complex, validated, reusable forms with no deep React knowledge required

25 lines (24 loc) 551 B
class a { queue = Promise.resolve(); /** * Adds an asynchronous task to the queue. * @param task the asynchronous task, optionally returning a cleanup function. * @returns the promise that will be resolved after the task is completed. */ add(r) { return new Promise((s, t) => { this.queue = this.queue.then(async () => { try { const e = await r(); s(e); } catch (e) { t(e); } }); }); } } export { a as AsyncQueue }; //# sourceMappingURL=AsyncQueue.js.map