minrk / ipython_extensions

My IPython extensions
Other
428 stars 71 forks source link

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

Open jkrajniak opened 9 years ago

jkrajniak commented 9 years ago

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"); });

jankatins commented 9 years ago

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

jkrajniak commented 9 years ago

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.

jkrajniak commented 9 years ago

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");
    });
});