title: jsPDF show loading while processing. Promise does not wait
body: <p>I'm using JSPDF and autotables plugin for PDF reports. While the PDF generation is happening I'm trying to show a loading image. Unfortunately, the loading is ignored even when trying with async(). </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function createPDF(){
    return new Promise(resolve =&gt; {
     var doc = new jsPDF();
      doc.autoTable({
          body: [
              ['Elmo', 'Hello'],
              ['Bert', 'The Muppet Show.']
          ]
      });
      
      // mimik time for processing
      setTimeout(function(){
        console.log('wait time for loading image')
      }, 8000);
  
      doc.save('table.pdf');
      resolve('resolved');
  
      });
  }
  
  async function asyncPDF() {
    document.getElementsByClassName('img__loading')[0].style.display = 'block';
    var result = await createPDF();
    document.getElementsByClassName('img__loading')[0].style.display = 'none';
  }
  
  document.getElementById('save').addEventListener("click", asyncPDF );</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.img__loading{
    display: none;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.5.3/jspdf.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.1.1/jspdf.plugin.autotable.min.js"&gt;&lt;/script&gt;
  
  
  &lt;button id="save"&gt;save&lt;/button&gt;
  &lt;img src="https://ui-ex.com/images/transparent-background-loading.gif" class="img__loading"&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>The question is why is the loading image not showing up? And why does it start working when wrapping the save() and resolve() inside the timeout?</p>
  
  <pre><code>  setTimeout(function(){
        doc.save('table.pdf');
        resolve('resolved');
    }, 8000);
  </code></pre>