mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 10:59:13 +00:00
refactor: use web utils and lazy load utils from core (#22289)
This commit is contained in:
parent
c6def993e0
commit
c8b2af8ed1
7 changed files with 164 additions and 301 deletions
|
@ -1,38 +1,7 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
import { op_lazy_load_esm } from "ext:core/ops";
|
||||
import { core } from "ext:core/mod.js";
|
||||
|
||||
let webgpu;
|
||||
const loadWebGPU = core.createLazyLoader("ext:deno_webgpu/01_webgpu.js");
|
||||
|
||||
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 };
|
||||
export { loadWebGPU };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue