mirror of
https://github.com/denoland/deno.git
synced 2025-01-03 12:58:54 -05:00
345423cf76
Follow up to #22157. This leaves us with 4 usages of `ensureFastOps()` in `deno` itself. There's also about 150 usages of `Deno.core.ops.<op_name>` left as well.
38 lines
664 B
JavaScript
38 lines
664 B
JavaScript
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
|
|
import { op_lazy_load_esm } from "ext:core/ops";
|
|
|
|
let webgpu;
|
|
|
|
function webGPUNonEnumerable(getter) {
|
|
let valueIsSet = false;
|
|
let value;
|
|
|
|
return {
|
|
get() {
|
|
loadWebGPU();
|
|
|
|
if (valueIsSet) {
|
|
return value;
|
|
} else {
|
|
return getter();
|
|
}
|
|
},
|
|
set(v) {
|
|
loadWebGPU();
|
|
|
|
valueIsSet = true;
|
|
value = v;
|
|
},
|
|
enumerable: false,
|
|
configurable: true,
|
|
};
|
|
}
|
|
|
|
function loadWebGPU() {
|
|
if (!webgpu) {
|
|
webgpu = op_lazy_load_esm("ext:deno_webgpu/01_webgpu.js");
|
|
}
|
|
}
|
|
|
|
export { loadWebGPU, webgpu, webGPUNonEnumerable };
|