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
merged 1 commit into from Mar 19, 2018

Conversation

Projects
None yet
2 participants
@Madhu94
Contributor

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

This comment has been minimized.

Member

jasongrout commented Mar 17, 2018

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

This comment has been minimized.

Contributor

Madhu94 commented Mar 17, 2018

@jasongrout

This comment has been minimized.

Member

jasongrout commented Mar 17, 2018

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

@Madhu94 Madhu94 force-pushed the Madhu94:configurable-widget-loader branch from 5c3512a to d3043d0 Mar 17, 2018

@Madhu94

This comment has been minimized.

Contributor

Madhu94 commented Mar 17, 2018

@jasongrout

This comment has been minimized.

Member

jasongrout commented Mar 17, 2018

No problem at all! You're doing great!

@Madhu94

This comment has been minimized.

Contributor

Madhu94 commented Mar 18, 2018

@jasongrout

This comment has been minimized.

Member

jasongrout commented Mar 18, 2018

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 Madhu94:configurable-widget-loader branch from d3043d0 to afd0e0d Mar 18, 2018

@jasongrout

This comment has been minimized.

Member

jasongrout commented Mar 18, 2018

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

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

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@jasongrout

This comment has been minimized.

Member

jasongrout commented Mar 19, 2018

Thanks again!

@jasongrout

This comment has been minimized.

Member

jasongrout commented Mar 19, 2018

@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 <nmadhum@deshaw.com>. 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 <nmadhum@deshaw.com>

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

This comment has been minimized.

Contributor

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 Madhu94:configurable-widget-loader branch Mar 20, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment