diff --git a/www/common/netflux-client.js b/www/common/netflux-client.js index 455b07c5b..e6567229a 100644 --- a/www/common/netflux-client.js +++ b/www/common/netflux-client.js @@ -4,7 +4,7 @@ define(() => { const MAX_LAG_BEFORE_PING = 15000; const MAX_LAG_BEFORE_DISCONNECT = 30000; const PING_CYCLE = 5000; -const REQUEST_TIMEOUT = 5000; +const REQUEST_TIMEOUT = 30000; const now = () => new Date().getTime(); @@ -205,7 +205,7 @@ const connect = (websocketURL) => { const req = ctx.requests[id]; if (now() - req.time > REQUEST_TIMEOUT) { delete ctx.requests[id]; - req.reject({ type: 'TIMEOUT', message: 'waited ' + now() - req.time + 'ms' }); + if(typeof req.reject === "function") { req.reject({ type: 'TIMEOUT', message: 'waited ' + now() - req.time + 'ms' }); } } } }, 5000); diff --git a/www/common/realtime-input.js b/www/common/realtime-input.js index bf173263d..3fd00231d 100644 --- a/www/common/realtime-input.js +++ b/www/common/realtime-input.js @@ -14,17 +14,15 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -window.Reflect = { has: function (x,y) { return (y in x); } }; define([ '/common/messages.js', '/common/netflux-client.js', '/common/crypto.js', - '/common/toolbar.js', '/common/TextPatcher.js', '/common/es6-promise.min.js', '/common/chainpad.js', '/bower_components/jquery/dist/jquery.min.js', -], function (Messages, Netflux, Crypto, Toolbar, TextPatcher) { +], function (Messages, Netflux, Crypto, TextPatcher) { var $ = window.jQuery; var ChainPad = window.ChainPad; var PARANOIA = true; @@ -41,37 +39,6 @@ define([ verbose = function (x) { console.log(x); }; verbose = function () {}; // comment out to enable verbose logging - // ------------------ Trapping Keyboard Events ---------------------- // - - var bindEvents = function (element, events, callback, unbind) { - for (var i = 0; i < events.length; i++) { - var e = events[i]; - if (element.addEventListener) { - if (unbind) { - element.removeEventListener(e, callback, false); - } else { - element.addEventListener(e, callback, false); - } - } else { - if (unbind) { - element.detachEvent('on' + e, callback); - } else { - element.attachEvent('on' + e, callback); - } - } - } - }; - - var getParameterByName = function (name, url) { - if (!url) { url = window.location.href; } - name = name.replace(/[\[\]]/g, "\\$&"); - var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), - results = regex.exec(url); - if (!results) { return null; } - if (!results[2]) { return ''; } - return decodeURIComponent(results[2].replace(/\+/g, " ")); - }; - var start = module.exports.start = function (config) {