-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
custom.js no longer triggering on app_initialized.NotebookApp #2403
Comments
Hello! I have a similar problem. My code has stoped to work in notebook 5.0.0: define([
'base/js/namespace',
'codemirror/keymap/sublime', // Это тоже js файл!
'base/js/events'
],
function(IPython, sublime_keymap, events) {
events.on("app_initialized.NotebookApp",
function () {
console.log("Load settings for codemirror cells")
var cell = require("notebook/js/cell").Cell;
cell.options_default.cm_config.lineNumbers = true;
cell.options_default.cm_config.keyMap = 'sublime';
cell.options_default.cm_config.lineWrapping = true;
cell.options_default.cm_config.autoCloseBrackets = true;
}
);
}
); How can I fix this? |
Outside of |
We should really have a promise for one-time events like this, so you can easily have code that waits for it, without worrying whether it already fired. |
Is there any workaround for this issue? |
This is kind-of fixed by #2710 (coming in notebook 5.1). The idea is that code that was previously using the define([
'base/js/namespace',
'base/js/promises'
], function(Jupyter, promises) {
promises.app_initialized.then(function(appname) {
if (appname === 'NotebookApp') {
do_stuff()
}
});
}); Unlike events, if the promise has already been resolved before you do this, then your code is run immediately. With events, it sits waiting for the event to fire again, which this one never does. I think that's as solved as this is likely to get, so I'm going to close the issue. |
It would be nice to update the documentation: https://github.com/jupyter/notebook/blob/4.0.x/notebook/static/custom/custom.js |
Is there a workaround for Jupyter 5.0? Anaconda doesn't seem to have anything newer.
|
It definitely should have newer versions that 5.0; we're up to 5.4.1 now, and Anaconda usually packages a new version within a few days of a release. |
Using notebook 5.0.0, my custom.js files is no longer triggering app_initialized.NotebookApp.
custom.js
The text was updated successfully, but these errors were encountered: