ArrayBuffer[@@species]
accessor property returns the
ArrayBuffer
构造函数。
The species accessor property returns the default constructor for
ArrayBuffer
objects. Subclass constructors may over-ride it to change the constructor assignment.
The species property returns the default constructor function, which is the
ArrayBuffer
constructor for
ArrayBuffer
对象:
ArrayBuffer[Symbol.species]; // function ArrayBuffer()
In a derived collection object (e.g. your custom array buffer
MyArrayBuffer
), the
MyArrayBuffer
species is the
MyArrayBuffer
constructor. However, you might want to overwrite this, in order to return parent
ArrayBuffer
objects in your derived class methods:
class MyArrayBuffer extends ArrayBuffer {
// Overwrite MyArrayBuffer species to the parent ArrayBuffer constructor
static get [Symbol.species]() { return ArrayBuffer; }
}
| 规范 |
|---|
|
ECMAScript (ECMA-262)
The definition of 'get ArrayBuffer [ @@species ]' in that specification. |
| Desktop | Mobile | Server | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@species
|
Chrome 51 | Edge 13 | Firefox 48 | IE No | Opera 38 | Safari 10 | WebView Android 51 | Chrome Android 51 | Firefox Android 48 | Opera Android 41 | Safari iOS 10 | Samsung Internet Android 5.0 |
nodejs
6.5.0
|
完整支持
不支持
用户必须明确启用此特征。
ArrayBuffer
ArrayBuffer.prototype.byteLength
get ArrayBuffer[@@species]
Function
Object
Object.prototype.__defineGetter__()
Object.prototype.__defineSetter__()
Object.prototype.__lookupGetter__()
Object.prototype.__lookupSetter__()
Object.prototype.hasOwnProperty()
Object.prototype.isPrototypeOf()
Object.prototype.propertyIsEnumerable()
Object.prototype.toLocaleString()
Object.prototype.toSource()
Object.prototype.toString()
Object.prototype.valueOf()
Object.setPrototypeOf()