Fix ArrayBuffer in WebWorker

ARRAY_BUFFER constant was set using global ArrayBuffer, but here instance checking is made against root.ArrayBuffer.
This breaks WebWorker which has no window.
With this simple fix, I am successfully using it in WebWorker.

Please tell me if you are interested in a pull request to make injecting into global object explicit and support ES6 modules.
pull/5/head
Mihal Malostanidis 8 years ago committed by GitHub
parent 310922df3b
commit b9c152b6cd

@ -184,7 +184,7 @@
return;
}
var notString = typeof(message) !== 'string';
if (notString && ARRAY_BUFFER && message instanceof root.ArrayBuffer) {
if (notString && ARRAY_BUFFER && message instanceof ArrayBuffer) {
message = new Uint8Array(message);
}
var code, index = 0, i, length = message.length || 0, blocks = this.blocks;

Loading…
Cancel
Save