• Initialize the Basis transcode worker.

    Parameters

    • Optional config: {
          eagerWorkers: boolean;
          fallbackUrl: string;
          glueUrl: string;
          lazyInit: boolean;
          maxRetries: number;
          numWorkers: number;
          rgbPriority: string[];
          rgbaPriority: string[];
          wasmUrl: string;
      }

      The Basis configuration.

      • eagerWorkers: boolean

        Use eager workers (default is true). When enabled, jobs are assigned to workers immediately, independent of their work load. This can result in unbalanced workloads, however there is no delay between jobs. If disabled, new jobs are assigned to workers only when their previous job has completed. This will result in balanced workloads across workers, however workers can be idle for a short time between jobs.

      • fallbackUrl: string

        URL of the fallback script to use when wasm modules aren't supported.

      • glueUrl: string

        URL of glue script.

      • lazyInit: boolean

        Wait for first transcode request before initializing Basis (default is false). Otherwise initialize Basis immediately.

      • maxRetries: number

        Number of http load retry attempts. Defaults to 5.

      • numWorkers: number

        Number of workers to use for transcoding (default is 1). While it is possible to improve transcode performance using multiple workers, this will likely depend on the runtime platform. For example, desktop will likely benefit from more workers compared to mobile. Also keep in mind that it takes time to initialize workers and increasing this value could impact application startup time. Make sure to test your application performance on all target platforms when changing this parameter.

      • rgbPriority: string[]

        Array of texture compression formats in priority order for textures without alpha. The supported compressed formats are: 'astc', 'atc', 'dxt', 'etc1', 'etc2', 'pvr'.

      • rgbaPriority: string[]

        Array of texture compression formats in priority order for textures with alpha. The supported compressed formats are: 'astc', 'atc', 'dxt', 'etc1', 'etc2', 'pvr'.

      • wasmUrl: string

        URL of the wasm module.

    Returns void