![]() |
The transfer() method of ArrayBuffer create a new ArrayBuffer that has the same byte content as the current buffer, then detach this current buffer, this means that merely the fresh buffer is able to get at the buried data and not any else. Such an option as transfer() comes in handy when there is a need to shift ArrayBuffers ownership between diverse contexts like from the main thread into Web Workers, additionally, it may make possible for better use of memory through reallocating more or less space within a new buffer without having an impact on old one. Syntaxtransfer() Parameters:
Return Type:A new Example 1: In the given below example we are transferring an ArrayBuffer.
Output: 8 Example 2: In the given below example we are transferring to a Smaller ArrayBuffer.
Output: 4 |
Reffered: https://www.geeksforgeeks.org
JavaScript |
Related |
---|
![]() |
![]() |
![]() |
![]() |
![]() |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 16 |