Remove old code from realtime-input

pull/1/head
Yann Flory 9 years ago
parent 6884b0890a
commit be09a1808d

@ -4,7 +4,7 @@ define(() => {
const MAX_LAG_BEFORE_PING = 15000; const MAX_LAG_BEFORE_PING = 15000;
const MAX_LAG_BEFORE_DISCONNECT = 30000; const MAX_LAG_BEFORE_DISCONNECT = 30000;
const PING_CYCLE = 5000; const PING_CYCLE = 5000;
const REQUEST_TIMEOUT = 5000; const REQUEST_TIMEOUT = 30000;
const now = () => new Date().getTime(); const now = () => new Date().getTime();
@ -205,7 +205,7 @@ const connect = (websocketURL) => {
const req = ctx.requests[id]; const req = ctx.requests[id];
if (now() - req.time > REQUEST_TIMEOUT) { if (now() - req.time > REQUEST_TIMEOUT) {
delete ctx.requests[id]; 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); }, 5000);

@ -14,17 +14,15 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
window.Reflect = { has: function (x,y) { return (y in x); } };
define([ define([
'/common/messages.js', '/common/messages.js',
'/common/netflux-client.js', '/common/netflux-client.js',
'/common/crypto.js', '/common/crypto.js',
'/common/toolbar.js',
'/common/TextPatcher.js', '/common/TextPatcher.js',
'/common/es6-promise.min.js', '/common/es6-promise.min.js',
'/common/chainpad.js', '/common/chainpad.js',
'/bower_components/jquery/dist/jquery.min.js', '/bower_components/jquery/dist/jquery.min.js',
], function (Messages, Netflux, Crypto, Toolbar, TextPatcher) { ], function (Messages, Netflux, Crypto, TextPatcher) {
var $ = window.jQuery; var $ = window.jQuery;
var ChainPad = window.ChainPad; var ChainPad = window.ChainPad;
var PARANOIA = true; var PARANOIA = true;
@ -41,37 +39,6 @@ define([
verbose = function (x) { console.log(x); }; verbose = function (x) { console.log(x); };
verbose = function () {}; // comment out to enable verbose logging 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 = var start = module.exports.start =
function (config) function (config)
{ {

Loading…
Cancel
Save