Skip to content
This repository has been archived by the owner on Aug 19, 2019. It is now read-only.

start-runner/parallel

Repository files navigation

start-parallel

npm linux build windows build coverage deps

Parallel tasks runner for Start.

💁 See also start-concurrent.

Install

npm install --save-dev start-parallel
# or
yarn add --dev start-parallel

Usage

import Start from 'start';
import reporter from 'start-pretty-reporter';
import parallel from 'start-parallel';

const start = Start(reporter());

export const tasksRunner1 = (...params) => {
  return function task1() {
    return new Promise((resolve) => {
      setTimeout(() => {
        resolve();
      }, 200);
    });
  };
};

export const tasksRunner2 = (...params) => {
  return function task2() {
    return new Promise((resolve) => {
      setTimeout(() => {
        resolve();
      }, 100);
    });
  };
};

export const tasksRunner12 = (...params) => start(
  parallel(
    'taskRunner1',
    'taskRunner2'
  )(...params)
);
→ parallel: start

→ task2: start
→ task2: done

→ task1: start
→ task1: done

→ parallel: done

  • works only with exported tasks runners