question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

API for getting URLs for JavaScript files?

See original GitHub issue

There is ipywidgets.embed.DEFAULT_EMBED_REQUIREJS_URL, but is there also an API to get the require.js URL?

I could probably use ipywidgets.embed.load_requirejs_template, but I don’t know if that’s part of the public API. Is it?

I’m also not quite sure if I’m supposed to use crossorigin="anonymous" or not. In load_requirejs_template it is hard-coded for one URL, and optional for the other.

In the end, I want to use those URLs in Sphinx, see https://github.com/spatialaudio/nbsphinx/issues/84.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:14 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
mgeiercommented, Oct 22, 2019

Is html_js_files just a global in conf.py?

That’s just how the Sphinx configuration works. The global variables are somehow automatically turned into Sphinx options (if those options exist). See http://www.sphinx-doc.org/en/master/usage/configuration.html.

Would it make sense for html_js_files to have this as a default value if not specified?

Well that’s the question!

The problem, as I see it, is that I would always need to import ipywidgets, even for projects which don’t use widgets. I don’t want to have ipywidgets as unconditional dependency.

However, now that I think about it, I might be able to check if widget states are used in any notebook and only import ipywidgets (and in turn include the .js URL) in this case …

In that case though, I shouldn’t use html_js_files, because I cannot detect user overrides (because it might be used for completely different JS files). But I could use a new configuration value, just like I’ve done for nbsphinx_requirejs_path (see https://github.com/spatialaudio/nbsphinx/pull/327). Something like nbsphinx_widgets_path?

Do you think this would be worthwhile?

It sounds promising … fully automatic widget support, but without overhead if widgets are not used.

1reaction
mgeiercommented, Nov 6, 2019

I think it would be helpful to mention in the docs that DEFAULT_EMBED_REQUIREJS_URL is considered part of the API.

And it would be good to know if I’m supposed to use crossorigin="anonymous" or not.

Read more comments on GitHub >

github_iconTop Results From Across the Web

URL.createObjectURL() - Web APIs | MDN
The URL.createObjectURL() static method creates a string containing a URL representing the object given in the parameter.
Read more >
LinkFinder - Script to search Endpoints in JavaScript Files
In this example, we are searching for .js files from the Desktop directory and looking for the endpoint /api/. Example 6: Ignore certain...
Read more >
How to Connect to an API with JavaScript - Tania Rascia
To get started, let's scroll to the films section. On the right you'll see GET /films . It will show us the URL...
Read more >
URL | Node.js v19.3.0 Documentation
The node:url module provides two APIs for working with URLs: a legacy API that is Node.js specific, and a newer API that implements...
Read more >
GerbenJavado/LinkFinder: A python script that finds ... - GitHub
A python script that finds endpoints in JavaScript files - GitHub - GerbenJavado/LinkFinder: A python script that finds endpoints in JavaScript files.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found