[IPython-dev] writing notebook extensions compatible with IPython.load_extensions
Max Linke
max_linke at gmx.de
Sun Jun 29 09:39:26 EDT 2014
Hi
I'm trying to write an extension that adds a new button the the toolbar.
I can't figure out how to use any IPython specific js functions when I
loading an extension with `IPython.load_extensions('test');`.
This is the code I have in ~/.ipython/nbextensions/test.js
IPython.toolbar.add_buttons_group([
{
'label' : 'test',
'icon' : 'icon-moon',
'id' : 'test-button'
}
]);
When I use this the js-console of chromium gives the following error
Uncaught TypeError: Cannot read property 'add_buttons_group' of
undefined
But if I load test.js in custom.js like this it works.
$([IPython.events]).on('app_initialized.NotebookApp',function(){
require(['nbextensions/test.js']);
});
What do I have to add to test.js so that the js functions in the IPython
namespace are not undefined?
best Max
More information about the IPython-dev
mailing list