ArrayBuffer.prototype.resizable
Baseline
2024
Newly available
Since July 2024, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
resizable 㯠ArrayBuffer ã¤ã³ã¹ã¿ã³ã¹ã®ã¢ã¯ã»ãµã¼ããããã£ã§ããã®é
åãããã¡ã¼ããµã¤ãºå¤æ´ãã©ããã表ãã¾ãã
試ãã¦ã¿ã¾ããã
const buffer1 = new ArrayBuffer(8, { maxByteLength: 16 });
const buffer2 = new ArrayBuffer(8);
console.log(buffer1.resizable);
// äºæ³ãããçµæ: true
console.log(buffer2.resizable);
// äºæ³ãããçµæ: false
解説
resizable ããããã£ã¯ã¢ã¯ã»ãµã¼ããããã£ã§ãããè¨å®ã¢ã¯ã»ãµã¼é¢æ°ã undefined ã§ãããããã®ããããã£ã¯èªã¿åããã¨ããã§ãã¾ããããã®å¤ã¯ããã®é
åãæ§ç¯ãããã¨ãã«ç¢ºå®ããã¾ããã³ã³ã¹ãã©ã¯ã¿ã¼ã§ maxByteLength ãªãã·ã§ã³ãè¨å®ããã¦ããã° resizable 㯠true ãè¿ããããã§ãªããã° false ãè¿ãã¾ãã
ä¾
>resizable ã®ä½¿ç¨
ãã®ä¾ã§ã¯ãæå¤§ 16 ãã¤ãã®é·ãã«ãµã¤ãºå¤æ´å¯è½ãª 8 ãã¤ãã®ãããã¡ã¼ã使ããresizable ããããã£ã調ã¹ã¦ãresizable ã true ãè¿ãå ´åã«ãµã¤ãºå¤æ´ãã¾ãã
const buffer = new ArrayBuffer(8, { maxByteLength: 16 });
if (buffer.resizable) {
console.log("Buffer is resizable!");
buffer.resize(12);
}
仿§æ¸
| Specification |
|---|
| ECMAScript® 2027 Language Specification> # sec-get-arraybuffer.prototype.resizable> |