[IPython-dev] Ways to attach javascript files to ipython notebooks

Matthias BUSSONNIER bussonniermatthias at gmail.com
Mon Aug 19 03:57:17 EDT 2013


> 
> from IPython.display import display,Javascript
> Javascript("""bar = 5;""")
> Javascript("""alert(window.bar)""")
> 

both should work. 
Maybe try explicit

Javascript("""window.bar = 5;""")




> In this case I would just load javascript files by hand from python code. 
> 
> What I would like to do: 
> Ability to attach javascript files from local filesystem (may be relative to ipython notebook location, but I'm ok with absolute files. I'm totally ok with loading these files globally, without any package management system, but I may use proper package management if needed.(this is required).

use $.getScript(url)

with absolute or (relative-prepended-with-/file prefix)



> I also would have some way to manipulate global javascript context (to change output displayed on the map). (this is required).
you will need to assign an id to the a div and use this as handle.


> Have ability to reload these files (when I'm making changes in js during developement). By reload I mean execute contents of these files again. (this would be nice to have)
Not much we can do for that, we are limited by browser compatibility.
IE reload the page and re-execute, unless your script can be executed many times.

> Ability to generate some javascript on the fly (I might need it, but if it is hard nevermind). 
This I don't see what you mean.

--
Matthias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20130819/bd9040ed/attachment.html>


More information about the IPython-dev mailing list