n-riesco / ijavascript

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

Is there a setting to reload the kernel on each click on the play button? #225

Closed henryfoster closed 3 years ago

henryfoster commented 4 years ago

Hi,

if I define a function in a cell and run it twice I get an exception telling me that the function is already defined. So each time I have to restart the kernel if I want to rerun my script. Is there a way to prevent this? I would like the cell just rerun everytime I select it and press play.

n-riesco commented 4 years ago

This shouldn't happen with the redefinition of a function. Usually, this kind of issue happens with the use of const.

The answer your question depends on the frontend you are using. For example, in the jupyter notebook, the button » restarts the kernel and reruns all the cells. You could also define your own keyboard shortcuts. By default, the jupyter notebook has already defined a keyboard shortcut just to restart a kernel: Esc 0 0