Skip to content

There's no way to tell when an SVG skin is loaded #563

@adroitwhiz

Description

@adroitwhiz

Expected Behavior

There should be some method by which API consumers like scratch-vm can create an SVG skin and run some other code only after the SVG skin is loaded.

Actual Behavior

Since an SVG skin's rendering is done asynchronously, there's a delay between when createSVGSkin is called and the SVG skin is actually renderable.

Right now, createSVGSkin returns the skin's ID immediately. It would be helpful to have a method (called awaitSVGSkin or similar) which creates an SVG skin and returns a Promise<skinID>, to ensure that the SVG skin is actually loaded.

Currently, vm.loadProject doesn't wait for SVG skins to load, which could cause potential test flakiness if tests are run before the skins are loaded. If an asynchronous SVG skin loading API is added, this could easily be fixed on the VM side by replacing this one call site.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions