Merge branch 'duplicateText2' into staging
This commit is contained in:
commit
c7688b7c8c
@ -879,7 +879,8 @@ define([
|
|||||||
postMessage("LEAVE_PAD", data, cb);
|
postMessage("LEAVE_PAD", data, cb);
|
||||||
};
|
};
|
||||||
pad.sendPadMsg = function (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.onReadyEvent = Util.mkEvent();
|
||||||
pad.onMessageEvent = Util.mkEvent();
|
pad.onMessageEvent = Util.mkEvent();
|
||||||
|
|||||||
@ -1596,7 +1596,10 @@ define([
|
|||||||
onConnect: function (wc, sendMessage) {
|
onConnect: function (wc, sendMessage) {
|
||||||
channel.sendMessage = function (msg, cId, cb) {
|
channel.sendMessage = function (msg, cId, cb) {
|
||||||
// Send to server
|
// Send to server
|
||||||
sendMessage(msg, function () {
|
sendMessage(msg, function (err) {
|
||||||
|
if (err) {
|
||||||
|
return void cb({ error: err });
|
||||||
|
}
|
||||||
// Broadcast to other tabs
|
// Broadcast to other tabs
|
||||||
channel.pushHistory(CpNetflux.removeCp(msg), /^cp\|/.test(msg));
|
channel.pushHistory(CpNetflux.removeCp(msg), /^cp\|/.test(msg));
|
||||||
channel.bcast("PAD_MESSAGE", {
|
channel.bcast("PAD_MESSAGE", {
|
||||||
|
|||||||
@ -45,10 +45,13 @@ define([
|
|||||||
var txid = mkTxid();
|
var txid = mkTxid();
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
var to = opts.timeout || 30000;
|
var to = opts.timeout || 30000;
|
||||||
var timeout = setTimeout(function () {
|
var timeout;
|
||||||
delete queries[txid];
|
if (to > 0) {
|
||||||
cb('TIMEOUT');
|
timeout = setTimeout(function () {
|
||||||
}, to);
|
delete queries[txid];
|
||||||
|
cb('TIMEOUT');
|
||||||
|
}, to);
|
||||||
|
}
|
||||||
acks[txid] = function (err) {
|
acks[txid] = function (err) {
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
delete acks[txid];
|
delete acks[txid];
|
||||||
|
|||||||
@ -61,10 +61,12 @@ define([
|
|||||||
logLevel: logLevel
|
logLevel: logLevel
|
||||||
});
|
});
|
||||||
_chainpad.onMessage(function(message, cb) {
|
_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(); }
|
if (!err) { evPatchSent.fire(); }
|
||||||
cb(err);
|
cb(err);
|
||||||
});
|
}, { timeout: -1 });
|
||||||
});
|
});
|
||||||
_chainpad.onPatch(function () {
|
_chainpad.onPatch(function () {
|
||||||
onRemote({ realtime: chainpad });
|
onRemote({ realtime: chainpad });
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user