Skip to content

Commit

Permalink
Remove the setTimeout() + bindAll() hack
Browse files Browse the repository at this point in the history
  • Loading branch information
cpsievert committed May 24, 2022
1 parent 1722948 commit 45398c8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
2 changes: 1 addition & 1 deletion ipyshiny/static/output.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 1 addition & 10 deletions js/src/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,12 @@ class IPyWidgetOutput extends Shiny.OutputBinding {
}
})
});
});
});
}
}

Shiny.outputBindings.register(new IPyWidgetOutput(), "shiny.IPyWidgetOutput");

// By the time this code executes (i.e., by the time the `callback` in
// `require(["@jupyter-widgets/html-manager"], callback)` executes, it seems to be too
// late to register the output binding in a way that it'll "just work" for dynamic UI.
// Moreover, when this code executes, dynamic UI when yet be loaded, so schedule
// a bind to happen on the next tick.
// TODO: this is a hack. Could we do something better?
setTimeout(() => { Shiny.bindAll(document.body); }, 0);


/******************************************************************************
* Handle messages from the server-side Widget
******************************************************************************/
Expand Down

0 comments on commit 45398c8

Please sign in to comment.