Skip to content

Parallel Executor (Array)

Joshua Jung edited this page Feb 24, 2017 · 3 revisions

The Parallel executor (src) lets you run a set of executors at the same time (similar to Promise.all).

Note: this example uses the Sleep executor.

controller.addListener('doABunchOfThingsFast', [
  () => {console.log('I'm so busy, I'm doing 5 things at once!');},
  [ // This second layered array indicates the contained executors are to be run at the same time
    100,
    1000,  // This one will complete last
    300,
    50,
    1
  ],
  () => {console.log('Whoops, I fell asleep for a second.');}
]);

Clone this wiki locally