cocos-enhance-kit/engine/polyfill/array-buffer.js

14 lines
521 B
JavaScript
Raw Permalink Normal View History

2022-06-24 16:23:03 +00:00
if (!ArrayBuffer.isView) {
const TypedArray = Object.getPrototypeOf(Int8Array);
ArrayBuffer.isView = (typeof TypedArray === 'function') ? function (obj) {
return obj instanceof TypedArray;
} : function (obj) {
// old JSC, phantom, QtWebview
if (typeof obj !== 'object') {
return false;
}
let ctor = obj.constructor;
return ctor === Float64Array || ctor === Float32Array || ctor === Uint8Array || ctor === Uint32Array || ctor === Int8Array;
};
}