Skip to content

Allow requireLoader to be configurable #1998

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/html-manager/src/libembed-amd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,14 @@ function requireLoader(moduleName: string, moduleVersion: string) {
* Render widgets in a given element.
*
* @param element (default document.documentElement) The element containing widget state and views.
* @param loader (default requireLoader) The function used to look up the modules containing
* the widgets' models and views classes. (The default loader looks them up on unpkg.com)
*/
export
function renderWidgets(element = document.documentElement) {
function renderWidgets(element = document.documentElement, loader: (moduleName: string, moduleVersion: string) => Promise<any> = requireLoader) {
requirePromise(['@jupyter-widgets/html-manager']).then((htmlmanager) => {
let managerFactory = () => {
return new htmlmanager.HTMLManager({loader: requireLoader});
return new htmlmanager.HTMLManager({loader: loader});
}
libembed.renderWidgets(managerFactory, element);
});
Expand Down