Avoid TypedArray.slice() because of IE11

This commit is contained in:
Samuel Mannehed 2018-06-15 12:00:43 +02:00
parent d9814c06bf
commit f90c2a6d4b
1 changed files with 1 additions and 2 deletions

View File

@ -100,11 +100,10 @@ Websock.prototype = {
rQshiftStr: function (len) {
if (typeof(len) === 'undefined') { len = this.rQlen(); }
const arr = this.rQshiftBytes(len);
let str = "";
// Handle large arrays in steps to avoid long strings on the stack
for (let i = 0; i < len; i += 4096) {
let part = arr.slice(i, Math.min(i + 4096, len));
let part = this.rQshiftBytes(Math.min(4096, len - i));
str += String.fromCharCode.apply(null, part);
}
return str;