mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-21 04:10:17 +08:00
Change global namespace logic to placehold with null
This commit is contained in:
parent
b8f25eea2f
commit
81e0fb3194
@ -6,8 +6,9 @@
|
|||||||
var Jupyter = window.Jupyter || {};
|
var Jupyter = window.Jupyter || {};
|
||||||
|
|
||||||
var jprop = function(name, module_path) {
|
var jprop = function(name, module_path) {
|
||||||
requirejs([module_path], function(loaded) {
|
if (Jupyter[name] === undefined) {
|
||||||
if (!Jupyter.hasOwnProperty(name)) {
|
Jupyter[name] = null;
|
||||||
|
requirejs([module_path], function(loaded) {
|
||||||
Object.defineProperty(Jupyter, name, {
|
Object.defineProperty(Jupyter, name, {
|
||||||
get: function() {
|
get: function() {
|
||||||
console.warn('accessing `'+name+'` is deprecated. Use `require("'+module_path+'")`');
|
console.warn('accessing `'+name+'` is deprecated. Use `require("'+module_path+'")`');
|
||||||
@ -16,15 +17,16 @@
|
|||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: false
|
configurable: false
|
||||||
});
|
});
|
||||||
}
|
}, function(err) {
|
||||||
}, function(err) {
|
console.warn('Jupyter.' + name + ' unavailable because "' + module_path + '" was not loaded.', err);
|
||||||
console.warn('Jupyter.' + name + ' unavailable because "' + module_path + '" was not loaded.', err);
|
});
|
||||||
});
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var jglobal = function(name, module_path){
|
var jglobal = function(name, module_path){
|
||||||
requirejs([module_path], function(loaded) {
|
if (Jupyter[name] === undefined) {
|
||||||
if (!Jupyter.hasOwnProperty(name)) {
|
Jupyter[name] = null;
|
||||||
|
requirejs([module_path], function(loaded) {
|
||||||
Object.defineProperty(Jupyter, name, {
|
Object.defineProperty(Jupyter, name, {
|
||||||
get: function() {
|
get: function() {
|
||||||
console.warn('accessing `'+name+'` is deprecated. Use `require("'+module_path+'").'+name+'`');
|
console.warn('accessing `'+name+'` is deprecated. Use `require("'+module_path+'").'+name+'`');
|
||||||
@ -33,10 +35,10 @@
|
|||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: false
|
configurable: false
|
||||||
});
|
});
|
||||||
}
|
}, function(err) {
|
||||||
}, function(err) {
|
console.warn('Jupyter.' + name + ' unavailable because "' + module_path + '" was not loaded.', err);
|
||||||
console.warn('Jupyter.' + name + ' unavailable because "' + module_path + '" was not loaded.', err);
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user