Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Small changes to clean up webagg javascript code a bit.
  • Loading branch information
Jason Grout
Jason Grout committed Nov 15, 2013
commit 79953bf39c0ff065a348ecf0981b7405131c35dc
14 changes: 4 additions & 10 deletions lib/matplotlib/backends/web_backend/mpl.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Put everything inside the mpl namespace */
var mpl = {};
/* Put everything inside the global mpl namespace */
window.mpl = {};


mpl.get_websocket_type = function() {
Expand Down Expand Up @@ -56,21 +56,15 @@ mpl.figure = function(figure_id, websocket, ondownload, parent_element) {

this.waiting = false;

onopen_creator = function(fig) {
return function () {
this.ws.onopen = function () {
fig.send_message("supports_binary", {value: fig.supports_binary});
fig.send_message("refresh", {});
}
};
this.ws.onopen = onopen_creator(fig);

onload_creator = function(fig) {
return function() {
this.imageObj.onload = function() {
fig.context.drawImage(fig.imageObj, 0, 0);
fig.waiting = false;
};
};
this.imageObj.onload = onload_creator(fig);

this.imageObj.onunload = function() {
this.ws.close();
Expand Down