mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-30 12:11:32 +08:00
Refactor out load_extensions_from_config function
This commit is contained in:
parent
53d1f1b1a1
commit
c719d2fe83
@ -39,6 +39,20 @@ define([
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Wait for a config section to load, and then load the extensions specified
|
||||
* in a 'load_extensions' key inside it.
|
||||
*/
|
||||
function load_extensions_from_config(section) {
|
||||
section.loaded.then(function() {
|
||||
if (section.data.load_extensions) {
|
||||
var nbextension_paths = Object.getOwnPropertyNames(
|
||||
section.data.load_extensions);
|
||||
IPython.load_extensions.apply(this, nbextension_paths);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
// Cross-browser RegEx Split
|
||||
//============================================================================
|
||||
@ -822,6 +836,7 @@ define([
|
||||
};
|
||||
|
||||
var utils = {
|
||||
load_extensions_from_config: load_extensions_from_config,
|
||||
regex_split : regex_split,
|
||||
uuid : uuid,
|
||||
fixConsole : fixConsole,
|
||||
|
@ -150,13 +150,7 @@ require([
|
||||
IPython.tooltip = notebook.tooltip;
|
||||
|
||||
events.trigger('app_initialized.NotebookApp');
|
||||
config_section.loaded.then(function() {
|
||||
if (config_section.data.load_extensions) {
|
||||
var nbextension_paths = Object.getOwnPropertyNames(
|
||||
config_section.data.load_extensions);
|
||||
IPython.load_extensions.apply(this, nbextension_paths);
|
||||
}
|
||||
});
|
||||
utils.load_extensions_from_config(config_section);
|
||||
notebook.load_notebook(common_options.notebook_path);
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user