@eigong/effekseer-webgpu-runtime 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -3,9 +3,4 @@ export declare const effekseerWebgpuRuntimeJsUrl: string
3
3
  export declare const effekseerWebgpuRuntimeWasmUrl: string
4
4
  export declare const effekseerWebgpuBridgeUrl: string
5
5
 
6
- export declare function getEffekseerWebGPURuntimeUrls(): {
7
- fflateUrl: string
8
- effekseerWebgpuRuntimeJsUrl: string
9
- effekseerWebgpuRuntimeWasmUrl: string
10
- effekseerWebgpuBridgeUrl: string
11
- }
6
+ export declare function loadEffekseerWebGPURuntime(): Promise<any>
package/index.js CHANGED
@@ -3,11 +3,24 @@ export const effekseerWebgpuRuntimeJsUrl = new URL('./runtime/Effekseer_WebGPU_R
3
3
  export const effekseerWebgpuRuntimeWasmUrl = new URL('./runtime/Effekseer_WebGPU_Runtime.wasm', import.meta.url).href
4
4
  export const effekseerWebgpuBridgeUrl = new URL('./runtime/effekseer.webgpu.src.js', import.meta.url).href
5
5
 
6
- export function getEffekseerWebGPURuntimeUrls() {
7
- return {
8
- fflateUrl,
9
- effekseerWebgpuRuntimeJsUrl,
10
- effekseerWebgpuRuntimeWasmUrl,
11
- effekseerWebgpuBridgeUrl,
6
+ function loadScript(src) {
7
+ return new Promise((resolve, reject) => {
8
+ const script = document.createElement('script')
9
+ script.src = src
10
+ script.onload = () => resolve()
11
+ script.onerror = reject
12
+ document.head.appendChild(script)
13
+ })
14
+ }
15
+
16
+ export async function loadEffekseerWebGPURuntime() {
17
+ await loadScript(fflateUrl)
18
+ await loadScript(effekseerWebgpuRuntimeJsUrl)
19
+ await loadScript(effekseerWebgpuBridgeUrl)
20
+
21
+ if (!globalThis.effekseer) {
22
+ throw new Error('Effekseer WebGPU runtime did not initialize.')
12
23
  }
24
+
25
+ return globalThis.effekseer
13
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eigong/effekseer-webgpu-runtime",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Redistributable Effekseer WebGPU runtime assets with MIT license notice",
5
5
  "type": "module",
6
6
  "main": "./index.js",