Search code examples
javascriptinternet-explorerpdfmake

How to prevent IE from freezing while long running script execution?


I'm experiencing quite long freezes of Internet Explorer while it's executing long run tasks. The task is about generating large PDF document using pdfmake and pure/vanilla javascript. So, that means I dont have control of what this script do, I just call it:

function getPdf(docDefinition, filename) {
    var t = Date.now();
    return pdfMake.createPdf(docDefinition).download(fileName + '.pdf', function() {
        console.log('pdfMake.createPdf: \'' + fileName + '.pdf\' generated in: ' + (Date.now() - t) + 'ms');
    });
}

For some large docs it take more than 30sec while I cant do anything.

How to prevent of freezing, so I could display some spinning wait icon, or somthing else?


Solution

  • Since version 10 IE supports web-workers which allow running JS on a different thread than the main thread.