Parallel.js have problems with Blob in IE

2020-05-02 19:37发布

问题:

I need to execute functions in "parallel" and I use parallel.js:

var p = new Parallel(items);

var fn1 = function (item) {
    doSomething(item);
};

p.map(fn1).then(function () {
    otherFunction();
});

But IE shows the following error:

[Q] Unhandled rejection reasons (should be empty): (no stack) SecurityError

HTML7007: One or more blob URLs were revoked by closing the blob 
for which they were created. These URLs will no longer resolve as 
the data backing the URL has been freed.

How to fix this error?

I had review parallel.js page in IE and all examples work fine.

I use Durandal, Breeze and Knockout.

In Firefox shows the following error:

[Q] Unhandled rejection reasons (should be empty): 
["(no stack) [Exception..... location: "<unknown>"]"]

and in Google Chrome no shows error, but parallel.js no work.

回答1:

In case you're still having trouble with this, to make Parallel.js work in Internet Explorer you have to include the evalPath option, as mentioned on the website:

evalPath (optional): This is the path to the file eval.js. This is required when running in node, and required when requiring files in browser environments (to work around cross-domain restrictions for web workers in IE 10).

This also applies to IE 11.

So your code will become:

var p = new Parallel(items, {evalPath: [PATH_TO_EVAL_JS]});

Where [PATH_TO_EVAL_JS] points to eval.js.