toJS property
Converts this ByteBuffer to a JSArrayBuffer by either casting, unwrapping, or cloning the ByteBuffer.
Throws if the ByteBuffer is backed by a JS SharedArrayBuffer.
Note
Depending on whether code is compiled to JavaScript or Wasm, this conversion will have different semantics.
When compiling to JavaScript, ByteBuffers are either ArrayBuffers or
SharedArrayBuffers so this will just check the type and cast, throwing
if it's a SharedArrayBuffer.
When compiling to Wasm, this ByteBuffer is a wrapper around an
ArrayBuffer if it was converted via JSArrayBufferToByteBuffer.toDart.
If it is a wrapper, this getter unwraps it and either returns the
ArrayBuffer or throws if the unwrapped buffer was a SharedArrayBuffer.
If it's instantiated in Dart, this getter clones this ByteBuffer's
values into a new JSArrayBuffer.
Avoid assuming that modifications to this ByteBuffer will affect the returned JSArrayBuffer and vice versa on all compilers unless it was first converted via JSArrayBufferToByteBuffer.toDart.
Implementation
external JSArrayBuffer get toJS;