Implement lock mechanisms for spreadsheets

This commit is contained in:
yflory
2019-01-24 15:26:35 +01:00
parent 2ac176eeec
commit ec2f21ec64
5 changed files with 521 additions and 307 deletions

View File

@@ -4186,85 +4186,87 @@ AscBrowser.convertToRetinaValue = function(value, isScale)
});
};
DocsCoApi.prototype._initSocksJs = function () {
var t = this;
var sockjs;
sockjs = this.sockjs = {};
var send = function (data) {
setTimeout(function () {
console.log(data);
sockjs.onmessage({
data: JSON.stringify(data)
});
});
};
var license = {
type: 'license',
license: {
type: 3,
light: false,
trial: false,
rights: 1,
buildVersion: "5.2.6",
buildNumber: 5,
branding: false
}
};
var channel;
require([
'/common/outer/worker-channel.js',
'/common/common-util.js'
], function (Channel, Util) {
var msgEv = Util.mkEvent();
var p = window.parent;
window.addEventListener('message', function (msg) {
if (msg.source !== p) { return; }
msgEv.fire(msg);
});
var postMsg = function (data) {
p.postMessage(data, '*');
};
Channel.create(msgEv, postMsg, function (chan) {
channel = chan;
send(license);
DocsCoApi.prototype._initSocksJs = function () {
var t = this;
var sockjs;
sockjs = this.sockjs = {};
var send = function (data) {
setTimeout(function () {
console.log(data);
sockjs.onmessage({
data: JSON.stringify(data)
});
});
};
var license = {
type: 'license',
license: {
type: 3,
mode: 0,
//light: false,
//trial: false,
rights: 1,
buildVersion: "5.2.6",
buildNumber: 2,
//branding: false
}
};
var channel;
require([
'/common/outer/worker-channel.js',
'/common/common-util.js'
], function (Channel, Util) {
var msgEv = Util.mkEvent();
var p = window.parent;
window.addEventListener('message', function (msg) {
if (msg.source !== p) { return; }
msgEv.fire(msg);
});
var postMsg = function (data) {
p.postMessage(data, '*');
};
Channel.create(msgEv, postMsg, function (chan) {
channel = chan;
send(license);
chan.on('CMD', function (obj) {
send(obj);
});
});
});
sockjs.onopen = function() {
t._state = ConnectionState.WaitAuth;
t.onFirstConnect();
};
sockjs.onopen();
});
});
sockjs.close = function () {
console.error('Close realtime');
};
sockjs.send = function (data) {
console.log(data);
try {
var obj = JSON.parse(data);
} catch (e) {
console.error(e);
return;
}
sockjs.onopen = function() {
t._state = ConnectionState.WaitAuth;
t.onFirstConnect();
};
sockjs.onopen();
sockjs.close = function () {
console.error('Close realtime');
};
sockjs.send = function (data) {
console.log(data);
try {
var obj = JSON.parse(data);
} catch (e) {
console.error(e);
return;
}
if (channel) {
channel.event('CMD', obj);
}
};
};
sockjs.onmessage = function (e) {
t._onServerMessage(e.data);
};
return sockjs;
};
return sockjs;
};
DocsCoApi.prototype._onServerOpen = function () {
if (this.reconnectTimeout) {