2020-08-05 23:08:13 +00:00
|
|
|
const strom = require("stromjs");
|
2020-08-03 22:54:40 +00:00
|
|
|
|
|
|
|
function sleep(time) {
|
|
|
|
return time > 0 ? new Promise(resolve => setTimeout(resolve, time)) : null;
|
|
|
|
}
|
|
|
|
|
|
|
|
strom
|
|
|
|
.fromArray([1, 2, 3, 4, 6, 8])
|
|
|
|
.pipe(
|
|
|
|
strom.parallelMap(async d => {
|
|
|
|
await sleep(10000 - d * 1000);
|
|
|
|
return `${d}`;
|
|
|
|
}, 3),
|
|
|
|
)
|
|
|
|
.pipe(process.stdout);
|