Add ArrayBuffer.isView and rework Array.isArray (#431)

This commit is contained in:
Max Graey
2019-02-03 11:41:04 +02:00
committed by Daniel Wirtz
parent 1867416236
commit 4829f3a3e4
18 changed files with 3530 additions and 2567 deletions

View File

@ -493,10 +493,14 @@ declare class ArrayBuffer {
readonly byteLength: i32;
/** Unsafe pointer to the start of the data in memory. */
readonly data: usize;
/** Returns true if value is one of the ArrayBuffer views, such as typed array or a DataView **/
static isView<T>(value: T): bool;
/** Constructs a new array buffer of the given length in bytes. */
constructor(length: i32, unsafe?: bool);
/** Returns a copy of this array buffer's bytes from begin, inclusive, up to end, exclusive. */
slice(begin?: i32, end?: i32): ArrayBuffer;
/** Returns a string representation of ArrayBuffer. */
toString(): string;
}
/** The `DataView` view provides a low-level interface for reading and writing multiple number types in a binary `ArrayBuffer`, without having to care about the platform's endianness. */