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 setting custom CDN for loading widgets. #2185

Closed
wants to merge 3 commits into from

Conversation

tarzzz
Copy link
Contributor

@tarzzz tarzzz commented Aug 27, 2018

Details: #1627 (comment)

@SylvainCorlay
Copy link
Member

Thanks!

Do you know if any other CDN supports semver suffixes in URLs like unpkg?

@tarzzz
Copy link
Contributor Author

tarzzz commented Aug 27, 2018

jsdelivr does. : )

@vidartf
Copy link
Member

vidartf commented Aug 28, 2018

Seems nice! Is there a natural place to add documentation for this?

"declare var" fails with a "not defined" error when window.__widgets_cdn__ is not defined.
but this seems to handle both cases well.
@tarzzz
Copy link
Contributor Author

tarzzz commented Aug 29, 2018

@SylvainCorlay Any concerns with merging this PR ..?

@@ -1,6 +1,8 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.

const __widgets_cdn__ = (window as any).__widgets_cdn__ || 'https://unpkg.com';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might be a bit cleaner if we make things more specific, like __jupyter_widgets_cdn__, or if we could figure out a nice way to not have a global variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the var name to __jupyter_widgets_cdn__ : )

@maartenbreddels
Copy link
Member

I think it is ok like this, but indeed, maybe we can do without a global, ala requirejs data-main.

<script type="text/javascript" data-cdn-prefix="https://unpkg.com" src="https://unpkg.com/@jupyter-widgets/html-manager@^0.14.0/dist/embed-amd.js"></script>

I don't know how you can access this attribute, but requirejs seems to be able to do it.

maartenbreddels added a commit to maartenbreddels/ipywidgets that referenced this pull request Aug 31, 2018
@maartenbreddels
Copy link
Member

Is #2191 a good alternative?

@tarzzz
Copy link
Contributor Author

tarzzz commented Aug 31, 2018

@maartenbreddels #2191 looks good to me, but I would let the team members @SylvainCorlay or @jasongrout decide : )

If it works without the need for setting a global variable, then it is a good option imho.

@jasongrout
Copy link
Member

jasongrout commented Sep 5, 2018

Closing in favor of #2191. Thanks for pushing this forward, @tarzzz!

@maartenbreddels - it'd be great if you could mention @tarzzz in a commit message, or rebase your PR on top of this so @tarzzz gets credit in the repo for the work done here.

maartenbreddels added a commit to maartenbreddels/ipywidgets that referenced this pull request Sep 5, 2018
maartenbreddels added a commit to maartenbreddels/ipywidgets that referenced this pull request Sep 5, 2018
@jasongrout jasongrout closed this Sep 5, 2018
@tarzzz tarzzz deleted the allow-custom-cdn branch September 14, 2018 20:30
@lock lock bot added the resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label May 21, 2020
@lock lock bot locked as resolved and limited conversation to collaborators May 21, 2020
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.

5 participants