IJavascript is an npm
package that implements a
Javasript kernel for IPython's graphical
notebook (also known as
Jupyter). An IPython notebook combines the creation of
rich-text documents (including mathematics, plots and videos) with the execution
of code in a number of programming languages.
The execution of code is carried out by means of a kernel that implements the IPython messaging protocol. There are kernels available for Python, Julia, Ruby, Haskell and now Javascript.
IJavascript implements the latest stable specification of the protocol, version 4.1. This specification will be updated to version 5.0 in the next release of IPython.
A repository of IPython notebooks can be found here.
The installation instructions of the prerequisites vary from platform to platform. In the Debian and Ubuntu distributions, it's enough to run the following command:
sudo apt-get install npm ipython ipython-notebook
For other platforms, instructions may be found at nodejs.org/download and ipython.org/install.
npm install ijavascript
To start an IPython notebook session with the Javascript kernel, simply run:
ijs
This command should open the IPython notebook dashboard in your default web browser:
By default, the dashboard opens the notebooks in the current working folder. The
command flag --notebook-dir=path/to/another/folder
can be used to open the
dashboard at a different folder:
ijs --notebook-dir=path/to/another/folder
Here's a sample notebook that makes use of the Javascript kernel:
By default, the Javascript kernel doesn't define global
. If security is not a
concern global
can be enabled by passing the following command flag:
ijs --ijs-enable-global
To obtain documentation for other command flags, run:
ipython notebook help
-
Capture
stdout
andstdin
of each Javascript session (this may require replacing vm with vm2). -
Complete the implementation of IPython's messaging protocol.