Change global namespace logic to placehold with null

This commit is contained in:
Jonathan Frederic 2015-08-18 17:50:54 -07:00
parent b8f25eea2f
commit 81e0fb3194

View File

@ -6,8 +6,9 @@
var Jupyter = window.Jupyter || {};
var jprop = function(name, module_path) {
requirejs([module_path], function(loaded) {
if (!Jupyter.hasOwnProperty(name)) {
if (Jupyter[name] === undefined) {
Jupyter[name] = null;
requirejs([module_path], function(loaded) {
Object.defineProperty(Jupyter, name, {
get: function() {
console.warn('accessing `'+name+'` is deprecated. Use `require("'+module_path+'")`');
@ -16,15 +17,16 @@
enumerable: true,
configurable: false
});
}
}, function(err) {
console.warn('Jupyter.' + name + ' unavailable because "' + module_path + '" was not loaded.', err);
});
}, function(err) {
console.warn('Jupyter.' + name + ' unavailable because "' + module_path + '" was not loaded.', err);
});
}
};
var jglobal = function(name, module_path){
requirejs([module_path], function(loaded) {
if (!Jupyter.hasOwnProperty(name)) {
if (Jupyter[name] === undefined) {
Jupyter[name] = null;
requirejs([module_path], function(loaded) {
Object.defineProperty(Jupyter, name, {
get: function() {
console.warn('accessing `'+name+'` is deprecated. Use `require("'+module_path+'").'+name+'`');
@ -33,10 +35,10 @@
enumerable: true,
configurable: false
});
}
}, function(err) {
console.warn('Jupyter.' + name + ' unavailable because "' + module_path + '" was not loaded.', err);
});
}, function(err) {
console.warn('Jupyter.' + name + ' unavailable because "' + module_path + '" was not loaded.', err);
});
}
}