Skip to content
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

Allow requireLoader to be configurable #1998

Merged

Conversation

Madhu94
Copy link
Contributor

@Madhu94 Madhu94 commented Mar 17, 2018

I'd really like to be able to configure where I look up the widget models and views classes, and not always pick up from unpkg (for inhouse software).

I didn't know if there was a better way to do it, but allowing a configurable loader for htmlManager might do it.

Please let me know if this can be merged or if there is a better solution to my problem

@jasongrout
Copy link
Member

Great idea! Can you do two changes to your PR?

  1. The type for the loader should be more specific: (moduleName: string, moduleVersion: string) => Promise<any>

  2. Can you push the default into the signature? Something like:

function renderWidgets(element = document.documentElement, loader: (moduleName: string, moduleVersion: string) => Promise<any> = requireLoader) {

@jasongrout jasongrout added this to the Minor release milestone Mar 17, 2018
@Madhu94
Copy link
Contributor Author

Madhu94 commented Mar 17, 2018 via email

@jasongrout
Copy link
Member

Now with the default in the signature, you don't need the ||.

@Madhu94 Madhu94 force-pushed the configurable-widget-loader branch from 5c3512a to d3043d0 Compare March 17, 2018 21:24
@Madhu94
Copy link
Contributor Author

Madhu94 commented Mar 17, 2018 via email

@jasongrout
Copy link
Member

No problem at all! You're doing great!

@Madhu94
Copy link
Contributor Author

Madhu94 commented Mar 18, 2018 via email

@jasongrout
Copy link
Member

One more thing - can you add a note to the function documentation about the loader, similar to the note for the element parameter? Then I think we're good to go.

@Madhu94 Madhu94 force-pushed the configurable-widget-loader branch from d3043d0 to afd0e0d Compare March 18, 2018 06:09
@jasongrout
Copy link
Member

Looks good, thanks! I'll wait for tests to pass before merging.

@jasongrout jasongrout merged commit 4a845ec into jupyter-widgets:master Mar 19, 2018
@jasongrout
Copy link
Member

Thanks again!

@jasongrout
Copy link
Member

@Madhu94 - one more thing. In our release notes, we give credit to people who contributed, using their full name (see https://groups.google.com/forum/#!msg/jupyter/j40P78_h3U4/K3vdg5VGCgAJ for example). Your commit right now shows that it is from nmadhum <[email protected]>. If you would like your proper name to appear in the release notes, could you add an entry to the .mailmap file (https://github.com/jupyter-widgets/ipywidgets/blob/master/.mailmap)? You would add a line in alphabetical order that looks like:

FirstName LastName <email> nmadhum <[email protected]>

Thanks!

Or if you just want to post your name here, I can add the listing. Of course, if you'd rather be mentioned just using your github username, that's fine too, and we won't add an entry to the mailmap.

And for the future, you can set your name in git so that it shows up in your git commits following the directions at https://help.github.com/articles/setting-your-username-in-git/.

@Madhu94
Copy link
Contributor Author

Madhu94 commented Mar 20, 2018

Thanks for your help @jasongrout, hopefully my next PR will go better as I won't be a Typescript novice by then.

I've updated the mailmap.

@Madhu94 Madhu94 deleted the configurable-widget-loader branch March 20, 2018 04:56
@github-actions github-actions bot added the resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Feb 7, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants