-
Notifications
You must be signed in to change notification settings - Fork 517
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add resizable ArrayBuffer examples (#2434)
* Add resizable ArrayBuffer examples * remove explanatory comments
- Loading branch information
1 parent
7f7dc1d
commit 56ec841
Showing
4 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
live-examples/js-examples/arraybuffer/arraybuffer-maxbytelength.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const buffer = new ArrayBuffer(8, { maxByteLength: 16 } ); | ||
|
||
console.log(buffer.byteLength); | ||
// Expected output: 8 | ||
|
||
console.log(buffer.maxByteLength); | ||
// Expected output: 16 |
8 changes: 8 additions & 0 deletions
8
live-examples/js-examples/arraybuffer/arraybuffer-resizable.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const buffer1 = new ArrayBuffer(8, { maxByteLength: 16 } ); | ||
const buffer2 = new ArrayBuffer(8); | ||
|
||
console.log(buffer1.resizable); | ||
// Expected output: true | ||
|
||
console.log(buffer2.resizable); | ||
// Expected output: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const buffer = new ArrayBuffer(8, { maxByteLength: 16 } ); | ||
|
||
console.log(buffer.byteLength); | ||
// Expected output: 8 | ||
|
||
buffer.resize(12); | ||
|
||
console.log(buffer.byteLength); | ||
// Expected output: 12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters