ecspresso
    Preparing search index...

    Function loadSound

    • Create a loader function for use with the asset manager. Returns a factory function that loads a Howl when called.

      Parameters

      • src: string | string[]

        URL(s) for the sound file

      • Optionaloptions: { html5?: boolean; preload?: boolean }

        Optional Howl configuration

      Returns () => Promise<Howl>

      Factory function compatible with asset manager's loader parameter

      const ecs = ECSpresso.create()
      .withAssets(a => a
      .add('explosion', loadSound('/sounds/explosion.mp3'))
      .add('bgm', loadSound(['/sounds/bgm.webm', '/sounds/bgm.mp3']))
      )
      .build();