getWebGpuJsObject function

JSObject? getWebGpuJsObject(
  1. int handle
)

Retrieve the JS WebGPU object (GPUDevice, GPUBuffer, GPUTexture…) from its Emscripten integer handle.

Returns null if handle is 0 or the object is not present in the table.

Implementation

JSObject? getWebGpuJsObject(int handle) {
  if (handle == 0) return null;
  try {
    final result = _emscriptenWebGpu.getJsObject(handle.toJS);
    return result is JSObject ? result : null;
  } catch (_) {
    return null;
  }
}