We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
用于创建 ArrayBuffer 对象。
ArrayBuffer
true
null
false
undefined
ArrayBuffer.isView(new ArrayBuffer(10)); // false ArrayBuffer.isView(new Uint8Array()); // true
this
SharedArrayBuffer
初始值为 %ArrayBuffer%
这俩不同。 Array 可以动态扩展;ArrayBuffer 表示固定长度的原始二进制数据缓冲区!
Array
使用 new ArrayBuffer(length) 创建指定大小的 ArrayBuffer 对象,但是不能像操作数组一样直接对其操作,几乎任何对 ArrayBuffer 的操作,都需要一个 视图。视图可以是 TypedArray,也可以是 DataView。
new ArrayBuffer(length)
也就是说想操作 ArrayBuffer,必须先用视图映射下,然后操作视图即可:
let buffer = new ArrayBuffer(16); // 创建一个字节长度为 16 的 buffer let view = new Uint32Array(buffer); // 将 buffer 视为一个 32 位整数的序列 console.log(view) // Uint32Array(4) [0, 0, 0, 0] // 让我们写入一个值 view[0] = 123456; // Uint32Array(4) [123456, 0, 0, 0]
The text was updated successfully, but these errors were encountered:
No branches or pull requests
ArrayBuffer 对象
AllocateArrayBuffer ( constructor, byteLength )
用于创建
ArrayBuffer
对象。true
IsDetachedBuffer ( arrayBuffer )
null
,返回true
false
还有很多抽象操作,感觉没必要全翻译
ArrayBuffer 构造器
ArrayBuffer ( length )
undefined
,抛 TypeError 异常构造器上的属性
ArrayBuffer.isView ( arg )
ArrayBuffer
视图(view)!!! PS:不是用来判断参数是不是ArrayBuffer
对象的false
true
false
ArrayBuffer 原型对象属性
get ArrayBuffer.prototype.byteLength
this
值SharedArrayBuffer
,抛 TypeError 异常true
,抛 TypeError 异常ArrayBuffer.prototype.constructor
初始值为 %ArrayBuffer%
ArrayBuffer.prototype.slice ( start, end )
this
值SharedArrayBuffer
,抛 TypeError 异常true
,抛 TypeError 异常undefined
,定义 relativeEnd 为 len;否则,定义 relativeEnd 为 ? ToInteger(end)SharedArrayBuffer
,抛 TypeError 异常true
,抛 TypeError 异常true
,抛 TypeError 异常true
,抛 TypeError 异常ArrayBuffer和Array
这俩不同。
Array
可以动态扩展;ArrayBuffer
表示固定长度的原始二进制数据缓冲区!使用
new ArrayBuffer(length)
创建指定大小的ArrayBuffer
对象,但是不能像操作数组一样直接对其操作,几乎任何对ArrayBuffer
的操作,都需要一个 视图。视图可以是 TypedArray,也可以是 DataView。也就是说想操作
ArrayBuffer
,必须先用视图映射下,然后操作视图即可:The text was updated successfully, but these errors were encountered: