mgpuObserveOwnContextRetirement function
Implementation
WebContextRetirement? mgpuObserveOwnContextRetirement(int deviceHandle) {
const observe = '_mgpuWebObserveContextRetirement';
const status = '_mgpuWebContextRetirementStatus';
const release = '_mgpuWebReleaseContextObservation';
if (!_hasMinigpuExport(observe) || !_hasMinigpuExport(status) ||
!_hasMinigpuExport(release)) {
return null;
}
final module = globalContext.getProperty<JSObject>('MinigpuModule'.toJS);
final token = module.callMethod<JSNumber>(observe.toJS, deviceHandle.toJS).toDartInt;
if (token <= 0) throw StateError('WebGPU creation observation was refused');
return WebContextRetirement._(module,
module.getProperty<JSFunction>(status.toJS),
module.getProperty<JSFunction>(release.toJS), token);
}