lib.es2024.arraybuffer.d.ts (2637B)
1 /*! ***************************************************************************** 2 Copyright (c) Microsoft Corporation. All rights reserved. 3 Licensed under the Apache License, Version 2.0 (the "License"); you may not use 4 this file except in compliance with the License. You may obtain a copy of the 5 License at http://www.apache.org/licenses/LICENSE-2.0 6 7 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 8 KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 9 WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 10 MERCHANTABLITY OR NON-INFRINGEMENT. 11 12 See the Apache Version 2.0 License for specific language governing permissions 13 and limitations under the License. 14 ***************************************************************************** */ 15 16 17 /// <reference no-default-lib="true"/> 18 19 interface ArrayBuffer { 20 /** 21 * If this ArrayBuffer is resizable, returns the maximum byte length given during construction; returns the byte length if not. 22 * 23 * [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/maxByteLength) 24 */ 25 get maxByteLength(): number; 26 27 /** 28 * Returns true if this ArrayBuffer can be resized. 29 * 30 * [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/resizable) 31 */ 32 get resizable(): boolean; 33 34 /** 35 * Resizes the ArrayBuffer to the specified size (in bytes). 36 * 37 * [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/resize) 38 */ 39 resize(newByteLength?: number): void; 40 41 /** 42 * Returns a boolean indicating whether or not this buffer has been detached (transferred). 43 * 44 * [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/detached) 45 */ 46 get detached(): boolean; 47 48 /** 49 * Creates a new ArrayBuffer with the same byte content as this buffer, then detaches this buffer. 50 * 51 * [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/transfer) 52 */ 53 transfer(newByteLength?: number): ArrayBuffer; 54 55 /** 56 * Creates a new non-resizable ArrayBuffer with the same byte content as this buffer, then detaches this buffer. 57 * 58 * [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/transferToFixedLength) 59 */ 60 transferToFixedLength(newByteLength?: number): ArrayBuffer; 61 } 62 63 interface ArrayBufferConstructor { 64 new (byteLength: number, options?: { maxByteLength?: number; }): ArrayBuffer; 65 }