n-riesco / ijavascript

IJavascript is a javascript kernel for the Jupyter notebook
Other
2.19k stars 185 forks source link

Access to DOM #51

Closed blaesus closed 9 years ago

blaesus commented 9 years ago

Can IJavaScript access DOM elements in the browser as IPython does? For example, in IPython, window object is available and the output cell is exposed as element. This would be tremendously useful for data visualizations with packages like D3. screen shot 2015-11-03 at 11 34 39 am

Thank you for building IJavaScript!

n-riesco commented 9 years ago

Yes, you can. It is briefly documented here.

I will add a tutorial and some tools to illustrate how to inject Javascript into the notebook, but not right now. First I want to finish refactoring the code shared amongst IJavascript, jp-babel and jp-coffeescript.

blaesus commented 9 years ago

@n-riesco Thank you. I'll close the issue for now.

blaesus commented 9 years ago

@n-riesco Though some trial and error, I managed to use D3 with IJavaScript: screen shot 2015-11-08 at 21 11 42

I'm hoping for more native support such as that with Tonic: https://tonicdev.com/kiernan/tonic-d3

I wonder if this would feasible with IJavaScript?

n-riesco commented 9 years ago

On 08/11/15 13:16, Andy Shu Xin wrote:

@n-riesco https://github.com/n-riesco Though some trial and error, I managed to use D3 with IJavaScript: screen shot 2015-11-08 at 21 11 42 https://cloud.githubusercontent.com/assets/233354/11020563/ca321320-865d-11e5-8c0a-ca8e0ac32205.png

Thank you for sharing this.

The reason that I'm not ready yet to recommend the use of jsdom is due to a conflict of versions:

I will drop the support for Ubuntu 14.04 LTS once Ubuntu 16.04 LTS is released.

I believe the version of Node.js to be distributed with Ubuntu 16.04 LTS is yet to be defined. It is promising that Debian Sid, Ubuntu's parent distribution, is already providing Node.js v4.2.2.

I'm hoping for more native support such as that with Tonic: https://tonicdev.com/kiernan/tonic-d3

I wonder if this would feasible with IJavaScript?

Yes, I think it's not only feasible but also desireable.

I also hope that the coming $$mimer$$ in IJavascript will make easy to provide custom outputs. A custom $$mimer$$ would be able to generate automatically a graphical output for specific types (DOM nodes, arrays, objects...).

blaesus commented 9 years ago

@n-riesco Wow, thanks for the information. I certainly look forward to it!