add 'onAbort' hook to realtime-input.js

pull/1/head
ansuz 9 years ago
parent e5bef52850
commit 1d6ccc99a1

@ -105,6 +105,7 @@ define([
// bind abort to onLeaving // bind abort to onLeaving
var abort = function (socket, realtime) { var abort = function (socket, realtime) {
realtime.abort(); realtime.abort();
realtime.toolbar.failed();
try { socket._socket.close(); } catch (e) { warn(e); } try { socket._socket.close(); } catch (e) { warn(e); }
}; };
@ -159,7 +160,7 @@ define([
var transformFunction = config.transformFunction || null; var transformFunction = config.transformFunction || null;
var socket; var socket;
if (config.socketAdaptor) { if (config.socketAdaptor) {
// do netflux stuff // do netflux stuff
} else { } else {
@ -293,6 +294,11 @@ define([
if (recoverableErrorCount >= MAX_RECOVERABLE_ERRORS) { if (recoverableErrorCount >= MAX_RECOVERABLE_ERRORS) {
warn("Giving up!"); warn("Giving up!");
abort(socket, realtime); abort(socket, realtime);
if (config.onAbort) {
config.onAbort({
socket
});
}
if (socketChecker) { clearInterval(socketChecker); } if (socketChecker) { clearInterval(socketChecker); }
} }
} else { } else {

Loading…
Cancel
Save