|
|
|
Each TypedArray
: is an intrinsic object that has the structure described below, differing only in the name used as the name instead of TypedArray , in is a function whose behaviour differs based upon the number and types of its arguments. The actual behaviour TypedArray depends upon the number and kind of arguments that are passed to it. is not intended to be called as a function and will throw an exception when called in that manner. extends extends clause of a class definition. Subclass constructors that intend to inherit the specified TypedArray behaviour must include a super super call to the TypedArray
to create and initialize the subclass instance with the internal state necessary to support the .prototype built-in methods. has a "length" property whose value is 3 𝔽 . Each TypedArray
performs the following steps when called: 1. If NewTarget is undefined , throw a TypeError exception. 2. Let constructorName be the String value of the Name value specified in TypedArray . 3. Let proto be "% "% TypedArray TypedArray .prototype%" .prototype%" . 4. Let numberOfArgs be the number of elements in args . 5. If numberOfArgs = 0, then a. Return ? ( constructorName , NewTarget, proto , 0). 6. Else, a. Let firstArgument be args [0]. b. If ( firstArgument ) is Object, then i. Let O be ? constructorName , NewTarget, proto ). ii. If firstArgument has a [[TypedArrayName]] internal slot, then 1. Perform ? InitializeTypedArrayFromTypedArray ( O , firstArgument ). iii. Else if firstArgument has an [[ArrayBufferData]] internal slot, then 1. If numberOfArgs > 1, let byteOffset be args [1]; else let byteOffset be undefined . 2. If numberOfArgs > 2, let length be args [2]; else let length be undefined . 3. Perform ? InitializeTypedArrayFromArrayBuffer O , firstArgument , byteOffset , length ). iv. Else, 1. : firstArgument ) is Object and firstArgument does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] internal slot. 2. Let usingIterator be ? firstArgument , ). 3. If usingIterator is not undefined , then a. Let values be ? ( firstArgument , usingIterator ). b. Perform ? O , values ). 4. Else, a. NOTE: firstArgument is not an Iterable so assume it is already an b. Perform ? InitializeTypedArrayFromArrayLike ( O , firstArgument ). v. Return O . c. Else, i. : firstArgument is not an Object. ii. Let elementLength ( firstArgument ). 23.2.5.1 TypedArray ( ... args ) 685 |