Skip to content

Creating a new "model_ready" event in widget.js #71

@SylvainCorlay

Description

@SylvainCorlay

I encountered the following problem with widgets that create sub-widgets from the JavaScript side in their JavaScript model constructor:

For example the gamepad widget creates subwidgets for the buttons and axes in its constructor. Once the connected trait attribute is set to True, the user may wire things to the gamepad buttons...

However, in the case of a page reload, I would like these widgets not to be replaced by new ones, when the constructor of the JavaScript side is executed. The part of the constructor containing the creation of the children should only occur after the state request resolves.

One way to solve this issue would be to create a model-ready event for that, of have a certain promise that gets resolved right away in the case of a new model, and after the state request resolves in case of page reload.

Suggestions welcome.

@jdfreder @jasongrout

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionfeature requestresolved-lockedClosed issues are locked after 30 days inactivity. Please open a new issue for related discussion.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions