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

A way to load assets once #319

Closed
shashi opened this issue Aug 20, 2015 · 10 comments
Closed

A way to load assets once #319

shashi opened this issue Aug 20, 2015 · 10 comments

Comments

@shashi
Copy link

shashi commented Aug 20, 2015

As explained in JuliaLang/IJulia.jl#339

Javascript containing web component declarations cannot be loaded safely by packages, because a kernel restart would cause the Javascript to be loaded again, which is a fatal error. What could be done about this?

@Carreau
Copy link
Member

Carreau commented Aug 20, 2015

I think that one of the things we are trying to figure out. Using declare() and require() from require.js it should be possible to get the things on the page only once, though it is not always easy in the of how to allow installation on a per-kernel basis.

It is one of the area where we would need experience from people that use javascript more than we do for this kind of things.

@shashi
Copy link
Author

shashi commented Aug 20, 2015

You're right, using require would be a nice way to do this. Or package's JS code can check for a specific global variable before loading this. This is not such a big deal as is #320

@rgbkrk
Copy link
Member

rgbkrk commented Aug 21, 2015

That's where @jdfreder's potential spec from #116 should come into play, IMO.

@jdfreder
Copy link
Contributor

It should be noted, additional work, somewhat related is being done in #268 which allows npm packages and modules to be used in the core notebook code (not yet extended to extensions).

@JamiesHQ
Copy link
Member

Hi All: Based on the activity on #116 is there still work to do on this issue & can it be closed? thanks!

@rgbkrk
Copy link
Member

rgbkrk commented Apr 26, 2017

This definitely still needs to be done, it's one of the biggest limitations of the notebook. @shashi are you still interested in this?

@shashi
Copy link
Author

shashi commented Apr 26, 2017

Yes of course! :)

@JamiesHQ
Copy link
Member

cc'ing @gnestor

@gnestor
Copy link
Contributor

gnestor commented Apr 26, 2017

So if an output contains an HTML import and that cell is run a 2nd time, it will try to do another HTML import and result in a fatal error?

The first solution that comes to mind is to create an extension and move the HTML imports and whatnot to it so that the HTML imports only happen on notebook load. This would also allow the web component(s) to be used across profiles and kernels. I've created a cookiecutter for generating renderer extensions for both classic notebook and JupyterLab. This allows your extension to register a custom mime type (e.g. application/vnd.compose3d+json) so that your when the kernel returns output of that mime type (a Julia library can handle this part), your extension will be used to render it. It should be pretty straight-forward to setup: put the HTML imports in register_renderer and the rendering code in append_mime.

@gnestor gnestor modified the milestones: Backlog, Reference Dec 7, 2017
@gnestor gnestor closed this as completed Dec 7, 2017
@shashi
Copy link
Author

shashi commented Dec 7, 2017

links to code are broken now. But thanks!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants