securityos/node_modules/fflate/lib/worker.cjs

21 lines
639 B
JavaScript

"use strict";
var ch2 = {};
exports["default"] = (function (c, id, msg, transfer, cb) {
var w = new Worker(ch2[id] || (ch2[id] = URL.createObjectURL(new Blob([
c + ';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'
], { type: 'text/javascript' }))));
w.onmessage = function (e) {
var d = e.data, ed = d.$e$;
if (ed) {
var err = new Error(ed[0]);
err['code'] = ed[1];
err.stack = ed[2];
cb(err, null);
}
else
cb(null, d);
};
w.postMessage(msg, transfer);
return w;
});