{"ScriptPreparationCode":"function delay(ms, val = true) {\r\n let timeoutId;\r\n return new Promise(resolve =\u003E {\r\n timeoutId = setTimeout(() =\u003E resolve(val), ms);\r\n });\r\n}\r\n\r\nfunction runTest(resultFunc) {\r\n\tconst res = resultFunc();\r\n\tfor(let i=0; i\u003C20; i\u002B\u002B) {\r\n \tres.add(delay(i));\r\n }\r\n \treturn res.get();\r\n}","TestCases":[{"Name":"Function based","Code":"const createResultPromiseFunc = () =\u003E {\r\n let res = Promise.resolve();\r\n return {\r\n get() { return res; },\r\n add(nextPromise) {\r\n res = res.then(() =\u003E nextPromise);\r\n return this;\r\n }\r\n };\r\n};\r\nrunTest(createResultPromiseFunc);","IsDeferred":false},{"Name":"Array based","Code":"const createResultPromiseArray = () =\u003E {\r\n const res = [];\r\n return {\r\n get() { return Promise.all(res); },\r\n add(nextPromise) {\r\n res.push(nextPromise);\r\n return this;\r\n }\r\n };\r\n};\r\nrunTest(createResultPromiseArray);","IsDeferred":false}]}