Skip to main content

coroutine

Callable


  • Excalibur coroutine helper, returns a [[CoroutineInstance]] which is promise-like when complete. Coroutines run before frame update by default.

    Each coroutine yield is 1 excalibur frame. Coroutines get passed the elapsed time our of yield. Coroutines run internally on the excalibur clock.

    If you yield a promise it will be awaited before resumed If you yield a number it will wait that many ms before resumed


    Parameters

    • thisArg: any

      set the "this" context of the generator, by default is globalThis

    • engine: Engine<any>

      pass a specific engine to use for running the coroutine

    • coroutineGenerator: CoroutineGenerator

      coroutine generator function

    • optionaloptions: CoroutineOptions

      optionally schedule coroutine pre/post update

    Returns CoroutineInstance