module.exports = function (self) {}
可能是问题的关键控制台错误
blob:https://[path-to-worker] Uncaught ReferenceError: e is not defined
它引用的e
在worker.js中是self
:
SRC
module.exports = function (self) {
self.addEventListener('message', function (e) {
importScripts(e.data.transformationURL);
var canvasData = e.data.canvasData;
var length = e.data.length;
var index = e.data.index;
transform(canvasData.data, length, e.data.options);
self.postMessage({
result: canvasData,
index: index
});
self.close();
});
};
压缩
e.addEventListener("message", function(t) {
importScripts(t.data.transformationURL);
var n = t.data.canvasData,
r = t.data.length,
o = t.data.index;
transform(n.data, r, t.data.options), e.postMessage({
result: n,
index: o
}), e.close()
})