From d3f0cc7b4dcf9c26f58b02528a7256d358973c94 2014-11-15 16:48:36 From: Jonathan Frederic Date: 2014-11-15 16:48:36 Subject: [PATCH] use es6 --- diff --git a/IPython/html/static/base/js/utils.js b/IPython/html/static/base/js/utils.js index 4a13efe..a0d9c3c 100644 --- a/IPython/html/static/base/js/utils.js +++ b/IPython/html/static/base/js/utils.js @@ -5,8 +5,7 @@ define([ 'base/js/namespace', 'jquery', 'codemirror/lib/codemirror', - 'rsvp', -], function(IPython, $, CodeMirror, rsvp){ +], function(IPython, $, CodeMirror){ "use strict"; IPython.load_extensions = function () { @@ -641,7 +640,7 @@ define([ // Tries to load a class from a module using require.js, if a module // is specified, otherwise tries to load a class from the global // registry, if the global registry is provided. - return new rsvp.Promise(function(resolve, reject) { + return new Promise(function(resolve, reject) { // Try loading the view module using require.js if (module_name) { @@ -664,13 +663,13 @@ define([ var resolve_dict = function(d) { // Resolve a promiseful dictionary. - // Returns a single rsvp.Promise. + // Returns a single Promise. var keys = Object.keys(d); var values = []; keys.forEach(function(key) { values.push(d[key]); }); - return rsvp.Promise.all(values).then(function(v) { + return Promise.all(values).then(function(v) { d = {}; for(var i=0; i 3.0 window.CodeMirror = CodeMirror; diff --git a/IPython/html/static/services/kernels/comm.js b/IPython/html/static/services/kernels/comm.js index 1e74b44..adf748c 100644 --- a/IPython/html/static/services/kernels/comm.js +++ b/IPython/html/static/services/kernels/comm.js @@ -5,8 +5,7 @@ define([ 'base/js/namespace', 'jquery', 'base/js/utils', - 'rsvp', -], function(IPython, $, utils, rsvp) { +], function(IPython, $, utils) { "use strict"; //----------------------------------------------------------------------- @@ -80,7 +79,7 @@ define([ that.unregister_comm(comm); var wrapped_error = new utils.WrappedError("Exception opening new comm", e); console.error(wrapped_error); - return rsvp.Promise.reject(wrapped_error); + return Promise.reject(wrapped_error); } return comm; }, utils.reject('Could not open comm', true)); diff --git a/IPython/html/static/widgets/js/manager.js b/IPython/html/static/widgets/js/manager.js index 9ab72ad..4a2a59a 100644 --- a/IPython/html/static/widgets/js/manager.js +++ b/IPython/html/static/widgets/js/manager.js @@ -7,8 +7,7 @@ define([ "jquery", "base/js/utils", "base/js/namespace", - 'rsvp', -], function (_, Backbone, $, utils, IPython, rsvp) { +], function (_, Backbone, $, utils, IPython) { "use strict"; //-------------------------------------------------------------------- // WidgetManager class @@ -50,7 +49,7 @@ define([ WidgetManager.prototype.display_view = function(msg, model) { // Displays a view for a particular model. var that = this; - return new rsvp.Promise(function(resolve, reject) { + return new Promise(function(resolve, reject) { var cell = that.get_msg_cell(msg.parent_header.msg_id); if (cell === null) { reject(new Error("Could not determine where the display" + @@ -241,7 +240,7 @@ define([ }, function(error) { delete that._models[model_id]; var wrapped_error = new utils.WrappedError("Couldn't create model", error); - return rsvp.Promise.reject(wrapped_error); + return Promise.reject(wrapped_error); }); this._models[model_id] = model_promise; return model_promise; diff --git a/IPython/html/static/widgets/js/widget.js b/IPython/html/static/widgets/js/widget.js index 630345a..0814988 100644 --- a/IPython/html/static/widgets/js/widget.js +++ b/IPython/html/static/widgets/js/widget.js @@ -7,8 +7,7 @@ define(["widgets/js/manager", "jquery", "base/js/utils", "base/js/namespace", - "rsvp", -], function(widgetmanager, _, Backbone, $, utils, IPython, rsvp){ +], function(widgetmanager, _, Backbone, $, utils, IPython){ var WidgetModel = Backbone.Model.extend({ constructor: function (widget_manager, model_id, comm) { @@ -23,7 +22,7 @@ define(["widgets/js/manager", // An ID unique to this model. // comm : Comm instance (optional) this.widget_manager = widget_manager; - this.state_change = rsvp.Promise.resolve(); + this.state_change = Promise.resolve(); this._buffered_state_diff = {}; this.pending_msgs = 0; this.msg_buffer = null; @@ -101,7 +100,7 @@ define(["widgets/js/manager", } finally { that.state_lock = null; } - return rsvp.Promise.resolve(); + return Promise.resolve(); }, utils.reject("Couldn't set model state", true)); }, @@ -262,7 +261,7 @@ define(["widgets/js/manager", _.each(value, function(sub_value, key) { unpacked.push(that._unpack_models(sub_value)); }); - return rsvp.Promise.all(unpacked); + return Promise.all(unpacked); } else if (value instanceof Object) { unpacked = {}; _.each(value, function(sub_value, key) { @@ -273,7 +272,7 @@ define(["widgets/js/manager", // get_model returns a promise already return this.widget_manager.get_model(value.slice(10, value.length)); } else { - return rsvp.Promise.resolve(value); + return Promise.resolve(value); } }, diff --git a/IPython/html/templates/page.html b/IPython/html/templates/page.html index 28d3005..93ba4b5 100644 --- a/IPython/html/templates/page.html +++ b/IPython/html/templates/page.html @@ -31,7 +31,6 @@ codemirror: 'components/codemirror', termjs: "components/term.js/src/term", contents: '{{ contents_js_source }}', - rsvp: "components/rsvp/rsvp", }, shim: { underscore: {