mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-21 04:10:17 +08:00
Use property on IPython/Jupyter global.
This allow the loading to be lazy, and to display a warning message on access.
This commit is contained in:
parent
fb6d92509b
commit
5ed24fdff0
@ -1,29 +1,56 @@
|
|||||||
// Copyright (c) Jupyter Development Team.
|
// Copyright (c) Jupyter Development Team.
|
||||||
// Distributed under the terms of the Modified BSD License.
|
// Distributed under the terms of the Modified BSD License.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
var Jupyter = Jupyter || {};
|
var Jupyter = Jupyter || {};
|
||||||
|
|
||||||
|
var jprop = function(name, module_path){
|
||||||
|
Object.defineProperty(Jupyter, name, {
|
||||||
|
get: function() {
|
||||||
|
console.warn('accessing `'+name+'` is deprecated. Use require("'+module_path+'")');
|
||||||
|
return require(module_path);
|
||||||
|
},
|
||||||
|
enumerable: true,
|
||||||
|
configurable: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var jglobal = function(name, module_path){
|
||||||
|
Object.defineProperty(Jupyter, name, {
|
||||||
|
get: function() {
|
||||||
|
console.warn('accessing `'+name+'` is deprecated. Use require("'+module_path+'").'+name);
|
||||||
|
return require(module_path)[name];
|
||||||
|
},
|
||||||
|
enumerable: true,
|
||||||
|
configurable: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
define(function(){
|
define(function(){
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// expose modules
|
// expose modules
|
||||||
Jupyter.utils = require('base/js/utils');
|
|
||||||
Jupyter.load_extensions = Jupyter.utils.load_extensions;
|
jprop('utils','base/js/utils')
|
||||||
|
|
||||||
Jupyter.security = require('base/js/security');
|
//Jupyter.load_extensions = Jupyter.utils.load_extensions;
|
||||||
Jupyter.keyboard = require('base/js/keyboard');
|
//
|
||||||
Jupyter.dialog = require('base/js/dialog');
|
jprop('security','base/js/security');
|
||||||
|
jprop('keyboard','base/js/keyboard');
|
||||||
|
jprop('dialog','base/js/dialog');
|
||||||
|
|
||||||
|
|
||||||
// exposed constructors
|
//// exposed constructors
|
||||||
var comm = require('services/kernels/comm');
|
jglobal('CommManager','services/kernels/comm')
|
||||||
Jupyter.CommManager = comm.CommManager;
|
jglobal('Comm','services/kernels/comm')
|
||||||
Jupyter.Comm = comm.Comm;
|
|
||||||
|
|
||||||
Jupyter.NotificationWidget = require('base/js/notificationwidget').NotificationWidget;
|
jglobal('NotificationWidget','base/js/notificationwidget');
|
||||||
Jupyter.Kernel = require('services/kernels/kernel').Kernel;
|
jglobal('Kernel','services/kernels/kernel');
|
||||||
Jupyter.Session = require('services/kernels/session').Session;
|
jglobal('Session','services/sessions/session');
|
||||||
Jupyter.LoginWidget = require('auth/js/loginwidget').LoginWidget
|
jglobal('LoginWidget','auth/js/loginwidget');
|
||||||
Jupyter.Page = require('base/js/page').Page;
|
jglobal('Page','base/js/page');
|
||||||
|
|
||||||
Jupyter.version = "4.0.0.dev";
|
Jupyter.version = "4.0.0.dev";
|
||||||
Jupyter._target = '_blank';
|
Jupyter._target = '_blank';
|
||||||
|
Loading…
Reference in New Issue
Block a user