title: Javascript: How to run async functions in different threads?
body: <p>I have an async function that returns a promise in my js code like the below;</p>
  
  <pre><code>async launch(){
    return new Promise (function(resolve, reject){
      let opts = {
        headless: false,
        defaultViewport: null,
        args: ['--start-maximized'],
        slowMo: 1,
        timeout: 10000
      };
      puppeteer
        .launch(opts)
        .then(function (browser) {    
          resolve(browser);
        });
    });
  }
  </code></pre>
  
  <p>It launches a new browser page by using puppeteer.</p>
  
  <h3>Usage:</h3>
  
  <pre><code>var browserLauncher = new BrowserLauncher();
  var browser = await browserLauncher.launch();
  var page = await browser.newPage();
  </code></pre>
  
  <p>So I would like to launch 5 browsers at the same time in different threads. How can I do that?</p>