mirror of
https://github.com/smallmain/cocos-enhance-kit.git
synced 2024-12-25 19:28:28 +00:00
14 lines
521 B
JavaScript
14 lines
521 B
JavaScript
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;
|
|
};
|
|
}
|