minrk/ipython_extensions

TypeError: IPython is undefined toc.js:136:8

jkrajniak opened this issue · 3 comments

Hi,

I tried to install ToC extension but I am getting the error TypeError: IPython is undefined
toc.js:136:8.
IPython verson: 2.3.0

my custom.js file:

$([IPython.events]).on("app_initialized.NotebookApp", function () {
IPython.load_extensions("toc");
});

I think you IPython 2.x is not supported anymore. you could probably checkout a older version and try that version.

I tested on notebook server is 3.1.0-cbccb68, now there is something wrong with the code in custom.js;
Mainly on the js console I've got that ReferenceError: $ is not defined
When I typed IPython.load_extensions("toc"); in js console then the button appear.

Following adding the extension to custom.js the correct code that works for me is:

require(["base/js/events"], function (events) {
    $([IPython.events]).on("app_initialized.NotebookApp", function () {
            /* load your extension here */
            IPython.load_extensions("toc");
    });
});