Merge branch 'duplicateText2' into staging

pull/1/head
yflory 5 years ago
commit c7688b7c8c

@ -879,7 +879,8 @@ define([
postMessage("LEAVE_PAD", data, cb);
};
pad.sendPadMsg = function (data, cb) {
postMessage("SEND_PAD_MSG", data, cb);
// -1 ==> no timeout, we may receive the callback only when we reconnect
postMessage("SEND_PAD_MSG", data, cb, { timeout: -1 });
};
pad.onReadyEvent = Util.mkEvent();
pad.onMessageEvent = Util.mkEvent();

@ -1596,7 +1596,10 @@ define([
onConnect: function (wc, sendMessage) {
channel.sendMessage = function (msg, cId, cb) {
// Send to server
sendMessage(msg, function () {
sendMessage(msg, function (err) {
if (err) {
return void cb({ error: err });
}
// Broadcast to other tabs
channel.pushHistory(CpNetflux.removeCp(msg), /^cp\|/.test(msg));
channel.bcast("PAD_MESSAGE", {

@ -45,10 +45,13 @@ define([
var txid = mkTxid();
opts = opts || {};
var to = opts.timeout || 30000;
var timeout = setTimeout(function () {
delete queries[txid];
cb('TIMEOUT');
}, to);
var timeout;
if (to > 0) {
timeout = setTimeout(function () {
delete queries[txid];
cb('TIMEOUT');
}, to);
}
acks[txid] = function (err) {
clearTimeout(timeout);
delete acks[txid];

@ -61,10 +61,12 @@ define([
logLevel: logLevel
});
_chainpad.onMessage(function(message, cb) {
sframeChan.query('Q_RT_MESSAGE', message, function (err) {
// -1 ==> no timeout, we may receive the callback only when we reconnect
sframeChan.query('Q_RT_MESSAGE', message, function (_err, obj) {
var err = _err || (obj && obj.error);
if (!err) { evPatchSent.fire(); }
cb(err);
});
}, { timeout: -1 });
});
_chainpad.onPatch(function () {
onRemote({ realtime: chainpad });

Loading…
Cancel
Save