From 75d356964b6a9a9e7fd4e327b4096b6283ff08dd Mon Sep 17 00:00:00 2001 From: Fabian Jakobs Date: Fri, 6 Nov 2015 11:53:28 +0000 Subject: [PATCH] add helper function --- plugins/c9.vfs.client/vfs_client.js | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/plugins/c9.vfs.client/vfs_client.js b/plugins/c9.vfs.client/vfs_client.js index 5f3e587b..9e11a4d0 100644 --- a/plugins/c9.vfs.client/vfs_client.js +++ b/plugins/c9.vfs.client/vfs_client.js @@ -94,9 +94,7 @@ define(function(require, exports, module) { connection.on("disconnect", onDisconnect); connection.on("connect", onConnect); - reconnect(function(err) { - connection.connect(); - }); + reconnectNow(); function connectEngine() { if (auth.accessToken) { @@ -203,6 +201,12 @@ define(function(require, exports, module) { + (isfile ? "&isfile=1" : "")); } + function reconnectNow() { + reconnect(function(_err) { + connection.connect(); + }); + } + function reconnect(callback) { connection.socket.setSocket(null); @@ -293,10 +297,7 @@ define(function(require, exports, module) { function callback(shouldReconnect) { if (shouldReconnect) { vfsEndpoint.clearCache(); - reconnect(function(err) { - if (err) return console.log(err); - connection.connect(); - }); + reconnectNow(); return; } @@ -383,11 +384,7 @@ define(function(require, exports, module) { rest: rest, download: download, url: vfsUrl, - reconnect: function() { - reconnect(function(_err) { - connection.connect(); - }); - }, + reconnect: reconnectNow, // File management resolve: vfsCall.bind(null, "resolve"),