UNPKG

js-draw

Version:

Draw pictures using a pen, touchscreen, or mouse! JS-draw is a drawing library for JavaScript and TypeScript.

20 lines (19 loc) 640 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * Resolves when all given promises have resolved. If no promises are given, * does not return a Promise. * * If all elements of `results` are known to be `Promise`s, use `Promise.all`. */ const waitForAll = (results) => { // If any are Promises... if (results.some((command) => command && command['then'])) { // Wait for all commands to finish. return (Promise.all(results) // Ensure we return a Promise<void> and not a Promise<void[]> .then(() => { })); } return; }; exports.default = waitForAll;