Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

removeEventListener in buffered calls

  • Loading branch information...
commit 60206b7627c2cd9b7e398e93c812739c0e2f6d97 1 parent 9a513f6
Mike de Boer mikedeboer authored
Showing with 10 additions and 14 deletions.
  1. +10 −14 plugins-client/cloud9.core/www/core/ide.js
24 plugins-client/cloud9.core/www/core/ide.js
View
@@ -80,23 +80,19 @@ define(function(require, exports, module) {
ide.start();
- // fire up the socket connection:
+ // fire up the socket connection:
if (window.cloud9config.debug) console.info("Connecting", JSON.parse(window.cloud9config.smithIo));
SMITH_IO.connect(JSON.parse(window.cloud9config.smithIo), function(err, connection) {
+ if (err)
+ return console.error(err);
- if (err) {
- console.error(err);
- return;
- }
-
ide.connection = connection;
connection.on("connect", function() {
- if (window.cloud9config.debug) {
+ if (window.cloud9config.debug)
console.info("Connected");
- }
-
+
ide.connecting = true;
// send over the internal method, otherwise it'll be queued
// because we aren't fully attached to the server yet
@@ -107,10 +103,9 @@ define(function(require, exports, module) {
});
});
connection.on("disconnect", function(reason) {
- if (window.cloud9config.debug) {
+ if (window.cloud9config.debug)
console.info("Disconnected");
- }
-
+
ide.connected = false;
ide.dispatchEvent("socketDisconnect");
});
@@ -166,7 +161,8 @@ define(function(require, exports, module) {
}
else {
// otherwise execute when we're done
- ide.addEventListener("socketConnect", function () {
+ ide.addEventListener("socketConnect", function onConnect() {
+ ide.removeEventListener("socketConnect", onConnect);
ide.connection.send(msg);
});
}
@@ -191,6 +187,6 @@ define(function(require, exports, module) {
return page.$model.data;
});
};
-
+
module.exports = ide;
});
Please sign in to comment.
Something went wrong with that request. Please try again.