diff options
author | Leo Kettmeir <crowlkats@toaxl.com> | 2024-02-06 22:28:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-06 22:28:32 +0100 |
commit | c8b2af8ed1b27822b0e6193b7a82903f54e56d95 (patch) | |
tree | 0ea57f0d038552971914d08b95e0dec5d93ef102 /ext/webgpu/00_init.js | |
parent | c6def993e052626be3933de4299bf4b2eb76e48a (diff) |
refactor: use web utils and lazy load utils from core (#22289)
Diffstat (limited to 'ext/webgpu/00_init.js')
-rw-r--r-- | ext/webgpu/00_init.js | 37 |
1 files changed, 3 insertions, 34 deletions
diff --git a/ext/webgpu/00_init.js b/ext/webgpu/00_init.js index b7014bd45..0f10847ce 100644 --- a/ext/webgpu/00_init.js +++ b/ext/webgpu/00_init.js @@ -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 }; |