----- Forwarded Message ----- From: "Amos Benari" <abenari@xxxxxxxxxx> To: spice-devel@xxxxxxxxxxxxxxxxxxxxx Cc: "Amos Benari" <abenari@xxxxxxxxxx> Sent: Sunday, March 3, 2013 1:55:48 AM Subject: [PATCH 2/2] added on succeess event --- main.js | 1 + spiceconn.js | 8 ++++++++ 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/main.js b/main.js index bd7b472..6b4e4cc 100644 --- a/main.js +++ b/main.js @@ -60,6 +60,7 @@ SpiceMainConn.prototype.process_channel_message = function(msg) if (msg.type == SPICE_MSG_MAIN_INIT) { this.log_info("Connected to " + this.ws.url); + this.report_success("Connected") this.main_init = new SpiceMsgMainInit(msg.data); this.connection_id = this.main_init.session_id; diff --git a/spiceconn.js b/spiceconn.js index b448881..4fb75d1 100644 --- a/spiceconn.js +++ b/spiceconn.js @@ -55,6 +55,8 @@ function SpiceConn(o) this.password = o.password; if (o.onerror !== undefined) this.onerror = o.onerror; + if (o.onsuccess !== undefined) + this.onsuccess = o.onsuccess; this.state = "connecting"; this.ws.parent = this; @@ -420,6 +422,12 @@ SpiceConn.prototype = throw(e); }, + report_success: function(m) + { + if (this.onsuccess != undefined) + this.onsuccess(m); + }, + cleanup: function() { if (this.timeout) -- 1.7.4.2 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel