mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-27 04:20:22 +08:00
Let kyle work on things
This commit is contained in:
parent
55dd626980
commit
e44d91229e
@ -10,28 +10,10 @@
|
||||
// });
|
||||
"use strict";
|
||||
|
||||
var Events = function () {};
|
||||
|
||||
var $events;
|
||||
if (window && window.IPython && window.IPython.$events) {
|
||||
$events = window.IPython.$events;
|
||||
} else if (global && global.IPython && global.IPython.$events) {
|
||||
$events = global.IPython.$events;
|
||||
} else {
|
||||
if (!window.jupyterEvents) {
|
||||
var $ = require('jquery');
|
||||
$events = $([new Events()]);
|
||||
}
|
||||
var events = $events[0];
|
||||
|
||||
// Backwards compatability.
|
||||
if (window && window.IPython) {
|
||||
window.IPython.events = events;
|
||||
window.IPython.$events = $events;
|
||||
window.IPython.Events = Events;
|
||||
} else if (global && global.IPython) {
|
||||
global.IPython.events = events;
|
||||
global.IPython.$events = $events;
|
||||
global.IPython.Events = Events;
|
||||
var Events = function () {};
|
||||
window.jupyterEvents = $([new Events()]);
|
||||
}
|
||||
|
||||
module.exports = $events;
|
||||
module.exports = window.jupyterEvents;
|
||||
|
@ -1,79 +1,69 @@
|
||||
// Copyright (c) Jupyter Development Team.
|
||||
// Distributed under the terms of the Modified BSD License.
|
||||
|
||||
"use strict";
|
||||
var Jupyter;
|
||||
if (window && window.Jupyter) {
|
||||
Jupyter = window.Jupyter;
|
||||
} else if (global && global.Jupyter) {
|
||||
Jupyter = global.Jupyter;
|
||||
} else {
|
||||
Jupyter = {};
|
||||
"use strict";
|
||||
|
||||
if (!window.Jupyter) {
|
||||
window.Jupyter = {};
|
||||
}
|
||||
|
||||
var jprop = function(name, loaded, module_path, global_mod) {
|
||||
if (!(window.Jupyter).hasOwnProperty(name)) {
|
||||
Object.defineProperty(window.Jupyter, name, {
|
||||
get: function() {
|
||||
console.warn('accessing `'+name+'` is deprecated. Use `require(\'' + module_path + '\')' + (global_mod ? '[\'' + name + '\']' : '') + '`');
|
||||
return global_mod ? loaded[name] : loaded;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: false
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// expose modules
|
||||
jprop('events', require('base/js/events'), 'base/js/events');
|
||||
jprop('utils', require('base/js/utils'), 'base/js/utils');
|
||||
jprop('security', require('base/js/security'), 'base/js/security');
|
||||
jprop('keyboard', require('base/js/keyboard'), 'base/js/keyboard');
|
||||
jprop('dialog', require('base/js/dialog'), 'base/js/dialog');
|
||||
jprop('mathjaxutils', require('notebook/js/mathjaxutils'), 'notebook/js/mathjaxutils');
|
||||
|
||||
//// exposed constructors
|
||||
jprop('CommManager', require('services/kernels/comm'), 'services/kernels/comm', true);
|
||||
jprop('Comm', require('services/kernels/comm'), 'services/kernels/comm', true);
|
||||
|
||||
jprop('NotificationWidget', require('base/js/notificationwidget'), 'base/js/notificationwidget', true);
|
||||
jprop('Kernel', require('services/kernels/kernel'), 'services/kernels/kernel', true);
|
||||
jprop('Session', require('services/sessions/session'), 'services/sessions/session', true);
|
||||
jprop('LoginWidget', require('auth/js/loginwidget'), 'auth/js/loginwidget', true);
|
||||
jprop('Page', require('base/js/page'), 'base/js/page', true);
|
||||
|
||||
// notebook
|
||||
jprop('TextCell', require('notebook/js/textcell'), 'notebook/js/textcell', true);
|
||||
jprop('OutputArea', require('notebook/js/outputarea'), 'notebook/js/outputarea', true);
|
||||
jprop('KeyboardManager', require('notebook/js/keyboardmanager'), 'notebook/js/keyboardmanager', true);
|
||||
jprop('Completer', require('notebook/js/completer'), 'notebook/js/completer', true);
|
||||
jprop('Notebook', require('notebook/js/notebook'), 'notebook/js/notebook', true);
|
||||
jprop('Tooltip', require('notebook/js/tooltip'), 'notebook/js/tooltip', true);
|
||||
jprop('ToolBar', require('notebook/js/toolbar'), 'notebook/js/toolbar', true);
|
||||
jprop('SaveWidget', require('notebook/js/savewidget'), 'notebook/js/savewidget', true);
|
||||
jprop('Pager', require('notebook/js/pager'), 'notebook/js/pager', true);
|
||||
jprop('QuickHelp', require('notebook/js/quickhelp'), 'notebook/js/quickhelp', true);
|
||||
jprop('MarkdownCell', require('notebook/js/textcell'), 'notebook/js/textcell', true);
|
||||
jprop('RawCell', require('notebook/js/textcell'), 'notebook/js/textcell', true);
|
||||
jprop('Cell', require('notebook/js/cell'), 'notebook/js/cell', true);
|
||||
jprop('MainToolBar', require('notebook/js/maintoolbar'), 'notebook/js/maintoolbar', true);
|
||||
jprop('NotebookNotificationArea', require('notebook/js/notificationarea'), 'notebook/js/notificationarea', true);
|
||||
jprop('NotebookTour', require( 'notebook/js/tour'), 'notebook/js/tour', true);
|
||||
jprop('MenuBar', require( 'notebook/js/menubar'), 'notebook/js/menubar', true);
|
||||
|
||||
// tree
|
||||
jprop('SessionList', require('tree/js/sessionlist'), 'tree/js/sessionlist', true);
|
||||
|
||||
window.Jupyter.version = "4.1.0.dev";
|
||||
window.Jupyter._target = '_blank';
|
||||
|
||||
// deprecated since 4.0, remove in 5+
|
||||
window.IPython = window.Jupyter;
|
||||
|
||||
var jprop = function(name, loaded, module_path, global) {
|
||||
if (!Jupyter.hasOwnProperty(name)) {
|
||||
Object.defineProperty(Jupyter, name, {
|
||||
get: function() {
|
||||
console.warn('accessing `'+name+'` is deprecated. Use `require(\'' + module_path + '\')' + (global ? '[\'' + name + '\']' : '') + '`');
|
||||
return global ? loaded[name] : loaded;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: false
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// expose modules
|
||||
|
||||
jprop('utils', require('base/js/utils'), 'base/js/utils');
|
||||
|
||||
//Jupyter.load_extensions = Jupyter.utils.load_extensions;
|
||||
//
|
||||
jprop('security', require('base/js/security'), 'base/js/security');
|
||||
jprop('keyboard', require('base/js/keyboard'), 'base/js/keyboard');
|
||||
jprop('dialog', require('base/js/dialog'), 'base/js/dialog');
|
||||
jprop('mathjaxutils', require('notebook/js/mathjaxutils'), 'notebook/js/mathjaxutils');
|
||||
|
||||
|
||||
//// exposed constructors
|
||||
jprop('CommManager', require('services/kernels/comm'), 'services/kernels/comm', true);
|
||||
jprop('Comm', require('services/kernels/comm'), 'services/kernels/comm', true);
|
||||
|
||||
jprop('NotificationWidget', require('base/js/notificationwidget'), 'base/js/notificationwidget', true);
|
||||
jprop('Kernel', require('services/kernels/kernel'), 'services/kernels/kernel', true);
|
||||
jprop('Session', require('services/sessions/session'), 'services/sessions/session', true);
|
||||
jprop('LoginWidget', require('auth/js/loginwidget'), 'auth/js/loginwidget', true);
|
||||
jprop('Page', require('base/js/page'), 'base/js/page', true);
|
||||
|
||||
// notebook
|
||||
jprop('TextCell', require('notebook/js/textcell'), 'notebook/js/textcell', true);
|
||||
jprop('OutputArea', require('notebook/js/outputarea'), 'notebook/js/outputarea', true);
|
||||
jprop('KeyboardManager', require('notebook/js/keyboardmanager'), 'notebook/js/keyboardmanager', true);
|
||||
jprop('Completer', require('notebook/js/completer'), 'notebook/js/completer', true);
|
||||
jprop('Notebook', require('notebook/js/notebook'), 'notebook/js/notebook', true);
|
||||
jprop('Tooltip', require('notebook/js/tooltip'), 'notebook/js/tooltip', true);
|
||||
jprop('ToolBar', require('notebook/js/toolbar'), 'notebook/js/toolbar', true);
|
||||
jprop('SaveWidget', require('notebook/js/savewidget'), 'notebook/js/savewidget', true);
|
||||
jprop('Pager', require('notebook/js/pager'), 'notebook/js/pager', true);
|
||||
jprop('QuickHelp', require('notebook/js/quickhelp'), 'notebook/js/quickhelp', true);
|
||||
jprop('MarkdownCell', require('notebook/js/textcell'), 'notebook/js/textcell', true);
|
||||
jprop('RawCell', require('notebook/js/textcell'), 'notebook/js/textcell', true);
|
||||
jprop('Cell', require('notebook/js/cell'), 'notebook/js/cell', true);
|
||||
jprop('MainToolBar', require('notebook/js/maintoolbar'), 'notebook/js/maintoolbar', true);
|
||||
jprop('NotebookNotificationArea', require('notebook/js/notificationarea'), 'notebook/js/notificationarea', true);
|
||||
jprop('NotebookTour', require( 'notebook/js/tour'), 'notebook/js/tour', true);
|
||||
jprop('MenuBar', require( 'notebook/js/menubar'), 'notebook/js/menubar', true);
|
||||
|
||||
// tree
|
||||
jprop('SessionList', require('tree/js/sessionlist'), 'tree/js/sessionlist', true);
|
||||
|
||||
Jupyter.version = "4.1.0.dev";
|
||||
Jupyter._target = '_blank';
|
||||
|
||||
module.exports = Jupyter;
|
||||
if (window) window.Jupyter = Jupyter;
|
||||
if (global) global.Jupyter = Jupyter;
|
||||
|
||||
// deprecated since 4.0, remove in 5+
|
||||
if (window) window.IPython = Jupyter;
|
||||
module.exports = window.Jupyter;
|
||||
|
@ -3,30 +3,19 @@
|
||||
// Miscellaneous javascript tests
|
||||
//
|
||||
casper.notebook_test(function () {
|
||||
console.log('b');
|
||||
var jsver = this.evaluate(function () {
|
||||
console.log('a');
|
||||
var cell = IPython.notebook.get_cell(0);
|
||||
console.log('a2');
|
||||
cell.set_text('import notebook; print(notebook.__version__)');
|
||||
console.log('a3');
|
||||
cell.execute();
|
||||
console.log('a4');
|
||||
return IPython.version;
|
||||
});
|
||||
|
||||
console.log('b2');
|
||||
this.wait_for_output(0);
|
||||
|
||||
// refactor this into just a get_output(0)
|
||||
console.log('b3');
|
||||
this.then(function () {
|
||||
console.log('c');
|
||||
var result = this.get_output_cell(0);
|
||||
console.log('c2');
|
||||
this.test.assertEquals(result.text.trim(), jsver, 'IPython.version in JS matches server-side.');
|
||||
console.log('c3');
|
||||
});
|
||||
console.log('b4');
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user