Load underscore globally

This commit is contained in:
Jonathan Frederic 2015-08-21 17:28:34 -07:00
parent 03a5b47067
commit 7717a986d1
5 changed files with 17 additions and 7 deletions

View File

@ -63,7 +63,22 @@ module.exports = new Promise(function(resolve, reject) {
Object.defineProperty(window, 'CodeMirror', codeMirrorProperty);
console.log('CodeMirror loaded and available in global namespace');
resolve();
requirejs(['underscore'], function(_) {
var underscoreProperty = {
get: function() {
return _;
},
configurable: false
};
Object.defineProperty(window, '_', underscoreProperty);
console.log('underscore loaded and available in global namespace');
resolve();
}, function(err) {
console.error('could not load underscore');
reject(err);
});
}, function(err) {
console.error('could not load CodeMirror and/or it\'s plugins');
reject(err);

View File

@ -11,7 +11,6 @@
"use strict";
var utils = require('base/js/utils');
var _ = require('underscore');
/**

View File

@ -3,7 +3,6 @@
'use strict';
var dialog = require('base/js/dialog');
var _ = require('underscore');
var IPython = require('base/js/namespace');
$('#notebook_about').click(function () {

View File

@ -2,8 +2,6 @@
// Distributed under the terms of the Modified BSD License.
"use strict";
var _ = require('underscore');
var _deserialize_array_buffer = function (buf) {
var data = new DataView(buf);
// read the header: 1 + nbufs 32b integers

View File

@ -42,7 +42,6 @@
"rimraf": "^2.4.2",
"term.js": "~0.0.4",
"text-encoding": "~0.1",
"typeahead": "^0.2.0",
"underscore": "~1.5"
"typeahead": "^0.2.0"
}
}