rhodonite
    Preparing search index...

    Class ModuleManager

    A singleton module manager that handles dynamic loading and management of various modules such as WebGL, WebGPU, Effekseer, PBR, and XR modules.

    This class provides a centralized way to load modules on-demand and retrieve them when needed, helping to optimize bundle size by enabling code splitting.

    Index

    Methods

    • Retrieves a previously loaded module from the internal registry.

      Parameters

      • moduleName: string

        The name of the module to retrieve

      Returns any

      The loaded module if found, undefined otherwise

      const moduleManager = ModuleManager.getInstance();
      const webglModule = moduleManager.getModule('webgl');
      if (webglModule) {
      // Use the module
      }
    • Dynamically loads a module by name and stores it in the internal module registry. Supports loading WebGL, WebGPU, Effekseer, PBR, and XR modules with code splitting.

      Parameters

      • moduleName: string

        The name of the module to load (case-insensitive). Supported modules: 'webgl', 'webgpu', 'effekseer', 'pbr', 'xr'

      • Optionaloptions: { wasm?: string }

        Optional configuration object for module loading

        • Optionalwasm?: string

          WASM module URI, currently used only for Effekseer module

      Returns Promise<any>

      A promise that resolves to the loaded module

      Will throw an error if the module fails to load

      const moduleManager = ModuleManager.getInstance();
      const webglModule = await moduleManager.loadModule('webgl');
      const effekseerModule = await moduleManager.loadModule('effekseer', {
      wasm: '/path/to/effekseer.wasm'
      });