##// END OF EJS Templates
Add CommManager.new_comm...
MinRK -
Show More
@@ -40,6 +40,15 b' var IPython = (function (IPython) {'
40 40 }
41 41 };
42 42
43 CommManager.prototype.new_comm = function (target_name, data, callbacks, metadata, comm_id) {
44 // Create a new Comm, register it, and open its Kernel-side counterpart
45 // Mimics the auto-registration in `Comm.__init__` in the IPython Comm
46 var comm = new Comm(target_name, comm_id);
47 this.register_comm(comm);
48 comm.open(data, callbacks, metadata);
49 return comm;
50 };
51
43 52 CommManager.prototype.register_target = function (target_name, f) {
44 53 // Register a target function for a given target name
45 54 this.targets[target_name] = f;
@@ -72,7 +81,7 b' var IPython = (function (IPython) {'
72 81 console.log("Available targets are: ", this.targets);
73 82 return;
74 83 }
75 var comm = new Comm(content.comm_id);
84 var comm = new Comm(content.target_name, content.comm_id);
76 85 this.register_comm(comm);
77 86 try {
78 87 f(comm, msg);
@@ -114,9 +123,9 b' var IPython = (function (IPython) {'
114 123 // Comm base class
115 124 //-----------------------------------------------------------------------
116 125
117 var Comm = function (comm_id, target_name) {
118 this.comm_id = comm_id || new IPython.utils.uuid();
126 var Comm = function (target_name, comm_id) {
119 127 this.target_name = target_name;
128 this.comm_id = comm_id || IPython.utils.uuid();
120 129 this._msg_callback = this._close_callback = null;
121 130 };
122 131
General Comments 0
You need to be logged in to leave comments. Login now