mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-27 04:20:22 +08:00
Added method
property to messages from the front-end
This commit is contained in:
parent
d371e3772a
commit
8e1c52382c
@ -78,7 +78,7 @@ define(["components/underscore/underscore-min",
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var callbacks = this._make_callbacks(cell);
|
var callbacks = this._make_callbacks(cell);
|
||||||
var data = {'custom_content': content};
|
var data = {method: 'custom', custom_content: content};
|
||||||
this.comm.send(data, callbacks);
|
this.comm.send(data, callbacks);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -253,7 +253,7 @@ define(["components/underscore/underscore-min",
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var data = {sync_method: method, sync_data: send_json};
|
var data = {method: 'backbone', sync_method: method, sync_data: send_json};
|
||||||
|
|
||||||
var cell = null;
|
var cell = null;
|
||||||
if (this.last_modified_view != undefined && this.last_modified_view != null) {
|
if (this.last_modified_view != undefined && this.last_modified_view != null) {
|
||||||
|
@ -113,16 +113,19 @@ class Widget(LoggingConfigurable):
|
|||||||
def _handle_msg(self, msg):
|
def _handle_msg(self, msg):
|
||||||
"""Called when a msg is recieved from the frontend"""
|
"""Called when a msg is recieved from the frontend"""
|
||||||
data = msg['content']['data']
|
data = msg['content']['data']
|
||||||
|
method = data['method']
|
||||||
|
|
||||||
# Handle backbone sync methods CREATE, PATCH, and UPDATE
|
# Handle backbone sync methods CREATE, PATCH, and UPDATE
|
||||||
if 'sync_method' in data and 'sync_data' in data:
|
if method == 'backbone':
|
||||||
sync_method = data['sync_method']
|
if 'sync_method' in data and 'sync_data' in data:
|
||||||
sync_data = data['sync_data']
|
sync_method = data['sync_method']
|
||||||
self._handle_recieve_state(sync_data) # handles all methods
|
sync_data = data['sync_data']
|
||||||
|
self._handle_recieve_state(sync_data) # handles all methods
|
||||||
|
|
||||||
# Handle a custom msg from the front-end
|
# Handle a custom msg from the front-end
|
||||||
if 'custom_content' in data:
|
elif method == 'custom':
|
||||||
self._handle_custom_msg(data['custom_content'])
|
if 'custom_content' in data:
|
||||||
|
self._handle_custom_msg(data['custom_content'])
|
||||||
|
|
||||||
|
|
||||||
def _handle_custom_msg(self, content):
|
def _handle_custom_msg(self, content):
|
||||||
|
Loading…
Reference in New Issue
Block a user