title: How make promise execute synchronously?
body: <p>I use dom-to-image.js for converting dom to png image. As dom-to-image.js uses promise, the code executes asynchronously. I want to execute .then function synchronously.</p>
  
  <p>I have the following code:</p>
  
  <pre><code>domtoimage.toPng(document.getElementById("main")).then(function(dataUrl) {
      console.log(dataUrl);
  }).catch(function(error) {
      console.error('oops, something went wrong!', error);
  });
  
  console.log("this console should be executed after console.log(dataUrl)")
  </code></pre>
  
  <p>I want to execute .then function first, before executing <code>console.log("this console should be executed after console.log(dataUrl)")</code>.</p>
  
  <p>Please tell me some way to achieve this.</p>