微信小程序兼容TextDecoder
(function(global) {
/**
* 兼容TextDecoder
*/
if (typeof global.TextDecoder !== 'function') {
function _TextDecoder() {}
_TextDecoder.prototype.decode = function(arrayBuffer) {
// @ts-ignore
return decodeURIComponent(escape(String.fromCharCode.apply(null, new Uint8Array(arrayBuffer))));
};
// @ts-ignore
global.TextDecoder = _TextDecoder;
}
})(this || window || globalThis);