sync process
This commit is contained in:
parent
8fcd8f6809
commit
c337f37665
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
|||||||
!function n(e,t,r){function o(u,c){if(!t[u]){if(!e[u]){var s="function"==typeof require&&require;if(!c&&s)return s(u,!0);if(i)return i(u,!0);throw new Error("Cannot find module '"+u+"'")}var f=t[u]={exports:{}};e[u][0].call(f.exports,function(n){var t=e[u][1][n];return o(t?t:n)},f,f.exports,n,e,t,r)}return t[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(n,e){var t;t=function(){var n,e,t;return t=null,2===arguments.length?(t=new Peer(arguments[0]),e=arguments[1]):(t=new Peer(arguments[0],arguments[1]),t.on("error",function(n){throw new Error("Peerjs connector: "+n)}),t.on("disconnected",function(){throw new Error("Peerjs connector disconnected from signalling server. Cannot accept new connections. Not fatal, but not so good either..")}),e=arguments[2]),n=function(){function n(n,e,r,o){var i;this.engine=n,this.HB=e,this.execution_listener=r,this.yatta=o,this.peer=t,this.connections={},this.peer.on("connection",function(n){return function(e){return n.addConnection(e)}}(this)),i=function(n){return function(e){var t,r,o,i;if(e.uid.creator===n.HB.getUserId()&&"string"!=typeof e.uid.op_number){o=n.connections,i=[];for(r in o)t=o[r],i.push(t.send({op:e}));return i}}}(this),this.execution_listener.push(i)}return n.prototype.connectToPeer=function(n){return null==this.connections[n]&&n!==this.yatta.getUserId()?this.addConnection(t.connect(n)):void 0},n.prototype.getAllConnectionIds=function(){var n,e;e=[];for(n in this.connections)e.push(n);return e},n.prototype.addConnection=function(n){var e,t,r;return this.connections[n.peer]=n,t=!1,e=!1,n.on("data",function(r){return function(o){var i,u,c,s,f;if("empty_message"===o);else{if(null!=o.HB)return t=!0,r.engine.applyOpsCheckDouble(o.HB),n.send({conns:r.getAllConnectionIds()});if(null!=o.op)return r.engine.applyOp(o.op);if(null!=o.conns){for(s=o.conns,f=[],u=0,c=s.length;c>u;u++)i=s[u],f.push(r.connectToPeer(i));return f}if(null==o.state_vector)throw new Error("Can't parse this operation");if(!e)return n.send({HB:r.yatta.getHistoryBuffer()._encode(o.state_vector)}),e=!0}}}(this)),r=function(e){return function(){return n.send({state_vector:e.HB.getOperationCounter()}),t?void 0:setTimeout(r,100)}}(this),r()},n}(),t.on("open",function(t){return e(n,t)})},e.exports=t,"undefined"!=typeof window&&null!==window&&(null==window.Y&&(window.Y={}),window.Y.createPeerJsConnector=t)},{}]},{},[1]);
|
!function n(e,t,r){function o(u,s){if(!t[u]){if(!e[u]){var c="function"==typeof require&&require;if(!s&&c)return c(u,!0);if(i)return i(u,!0);throw new Error("Cannot find module '"+u+"'")}var a=t[u]={exports:{}};e[u][0].call(a.exports,function(n){var t=e[u][1][n];return o(t?t:n)},a,a.exports,n,e,t,r)}return t[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(n,e){var t;t=function(){var n,e,t;return t=null,2===arguments.length?(t=new Peer(arguments[0]),e=arguments[1]):(t=new Peer(arguments[0],arguments[1]),t.on("error",function(n){throw new Error("Peerjs connector: "+n)}),t.on("disconnected",function(){throw new Error("Peerjs connector disconnected from signalling server. Cannot accept new connections. Not fatal, but not so good either..")}),e=arguments[2]),n=function(){function n(n,e,r,o){var i,u;this.engine=n,this.HB=e,this.execution_listener=r,this.yatta=o,this.peer=t,this.connections={},this.peer.on("connection",function(n){return function(e){return n.addConnection(e)}}(this)),u=function(n){return function(){var e,t,r,o;r=n.connections,o=[];for(t in r)e=r[t],o.push(e.send({sync_state_vector:n.HB.getOperationCounter()}));return o}}(this),setInterval(u,8e3),i=function(n){return function(e){var t,r,o,i;if(e.uid.creator===n.HB.getUserId()&&"string"!=typeof e.uid.op_number){o=n.connections,i=[];for(r in o)t=o[r],i.push(t.send({op:e}));return i}}}(this),this.execution_listener.push(i)}return n.prototype.connectToPeer=function(n){return null==this.connections[n]&&n!==this.yatta.getUserId()?this.addConnection(t.connect(n)):void 0},n.prototype.getAllConnectionIds=function(){var n,e;e=[];for(n in this.connections)e.push(n);return e},n.prototype.addConnection=function(n){var e,t,r;return this.connections[n.peer]=n,t=!1,e=!1,n.on("data",function(r){return function(o){var i,u,s,c,a;if("empty_message"===o);else if(null!=o.HB){if(t=!0,r.engine.applyOpsCheckDouble(o.HB),!o.initialized)return n.send({conns:r.getAllConnectionIds()})}else{if(null!=o.op)return r.engine.applyOp(o.op);if(null!=o.conns){for(c=o.conns,a=[],u=0,s=c.length;s>u;u++)i=c[u],a.push(r.connectToPeer(i));return a}if(null!=o.sync_state_vector)return console.log("turinae"),n.send({HB:r.yatta.getHistoryBuffer()._encode(o.sync_state_vector),initialized:!0});if(null==o.state_vector)throw new Error("Can't parse this operation");if(!e)return n.send({HB:r.yatta.getHistoryBuffer()._encode(o.state_vector),initialized:!1}),e=!0}}}(this)),r=function(e){return function(){return n.send({state_vector:e.HB.getOperationCounter()}),t?void 0:setTimeout(r,100)}}(this),r()},n}(),t.on("open",function(t){return e(n,t)})},e.exports=t,"undefined"!=typeof window&&null!==window&&(null==window.Y&&(window.Y={}),window.Y.createPeerJsConnector=t)},{}]},{},[1]);
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
build/browser/Frameworks/XmlFramework.min.js
vendored
4
build/browser/Frameworks/XmlFramework.min.js
vendored
File diff suppressed because one or more lines are too long
@ -19,7 +19,7 @@
|
|||||||
}
|
}
|
||||||
PeerJsConnector = (function() {
|
PeerJsConnector = (function() {
|
||||||
function PeerJsConnector(engine, HB, execution_listener, yatta) {
|
function PeerJsConnector(engine, HB, execution_listener, yatta) {
|
||||||
var send_;
|
var send_, sync_every_collaborator;
|
||||||
this.engine = engine;
|
this.engine = engine;
|
||||||
this.HB = HB;
|
this.HB = HB;
|
||||||
this.execution_listener = execution_listener;
|
this.execution_listener = execution_listener;
|
||||||
@ -31,6 +31,21 @@
|
|||||||
return _this.addConnection(conn);
|
return _this.addConnection(conn);
|
||||||
};
|
};
|
||||||
})(this));
|
})(this));
|
||||||
|
sync_every_collaborator = (function(_this) {
|
||||||
|
return function() {
|
||||||
|
var conn, conn_id, _ref, _results;
|
||||||
|
_ref = _this.connections;
|
||||||
|
_results = [];
|
||||||
|
for (conn_id in _ref) {
|
||||||
|
conn = _ref[conn_id];
|
||||||
|
_results.push(conn.send({
|
||||||
|
sync_state_vector: _this.HB.getOperationCounter()
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
return _results;
|
||||||
|
};
|
||||||
|
})(this);
|
||||||
|
setInterval(sync_every_collaborator, 8000);
|
||||||
send_ = (function(_this) {
|
send_ = (function(_this) {
|
||||||
return function(o) {
|
return function(o) {
|
||||||
var conn, conn_id, _ref, _results;
|
var conn, conn_id, _ref, _results;
|
||||||
@ -78,9 +93,11 @@
|
|||||||
} else if (data.HB != null) {
|
} else if (data.HB != null) {
|
||||||
initialized_me = true;
|
initialized_me = true;
|
||||||
_this.engine.applyOpsCheckDouble(data.HB);
|
_this.engine.applyOpsCheckDouble(data.HB);
|
||||||
|
if (!data.initialized) {
|
||||||
return conn.send({
|
return conn.send({
|
||||||
conns: _this.getAllConnectionIds()
|
conns: _this.getAllConnectionIds()
|
||||||
});
|
});
|
||||||
|
}
|
||||||
} else if (data.op != null) {
|
} else if (data.op != null) {
|
||||||
return _this.engine.applyOp(data.op);
|
return _this.engine.applyOp(data.op);
|
||||||
} else if (data.conns != null) {
|
} else if (data.conns != null) {
|
||||||
@ -91,10 +108,17 @@
|
|||||||
_results.push(_this.connectToPeer(conn_id));
|
_results.push(_this.connectToPeer(conn_id));
|
||||||
}
|
}
|
||||||
return _results;
|
return _results;
|
||||||
|
} else if (data.sync_state_vector != null) {
|
||||||
|
console.log("turinae");
|
||||||
|
return conn.send({
|
||||||
|
HB: _this.yatta.getHistoryBuffer()._encode(data.sync_state_vector),
|
||||||
|
initialized: true
|
||||||
|
});
|
||||||
} else if (data.state_vector != null) {
|
} else if (data.state_vector != null) {
|
||||||
if (!initialized_him) {
|
if (!initialized_him) {
|
||||||
conn.send({
|
conn.send({
|
||||||
HB: _this.yatta.getHistoryBuffer()._encode(data.state_vector)
|
HB: _this.yatta.getHistoryBuffer()._encode(data.state_vector),
|
||||||
|
initialized: false
|
||||||
});
|
});
|
||||||
return initialized_him = true;
|
return initialized_him = true;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
@ -66,7 +66,9 @@
|
|||||||
var o;
|
var o;
|
||||||
o = this.parseOperation(op_json);
|
o = this.parseOperation(op_json);
|
||||||
this.HB.addToCounter(o);
|
this.HB.addToCounter(o);
|
||||||
if (!o.execute()) {
|
if (this.HB.getOperation(o) != null) {
|
||||||
|
|
||||||
|
} else if (!o.execute()) {
|
||||||
this.unprocessed_ops.push(o);
|
this.unprocessed_ops.push(o);
|
||||||
} else {
|
} else {
|
||||||
this.HB.addOperation(o);
|
this.HB.addOperation(o);
|
||||||
@ -83,7 +85,9 @@
|
|||||||
_ref = this.unprocessed_ops;
|
_ref = this.unprocessed_ops;
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
op = _ref[_i];
|
op = _ref[_i];
|
||||||
if (!op.execute()) {
|
if (this.HB.getOperation(op) != null) {
|
||||||
|
|
||||||
|
} else if (!op.execute()) {
|
||||||
unprocessed.push(op);
|
unprocessed.push(op);
|
||||||
} else {
|
} else {
|
||||||
this.HB.addOperation(op);
|
this.HB.addOperation(op);
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -271,7 +271,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 11:05:22 by
|
September 29, 14 11:58:14 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -302,7 +302,7 @@ data from the received intent.</p>
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 11:05:22 by
|
September 29, 14 11:58:14 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -335,7 +335,7 @@ JsonFramework was initialized (Depending on the HistoryBuffer implementation).</
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 11:05:22 by
|
September 29, 14 11:58:14 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -466,7 +466,7 @@ if (x.type === "JsonType") {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 11:05:22 by
|
September 29, 14 11:58:14 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -139,7 +139,7 @@ console.log(w.newProperty == "Awesome") # true!</code></pre>
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 11:05:22 by
|
September 29, 14 11:58:14 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -222,7 +222,7 @@ on how to do that with urls.</p>
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 11:05:22 by
|
September 29, 14 11:58:14 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -356,7 +356,7 @@ JsonFramework was initialized (Depending on the HistoryBuffer implementation).</
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 11:05:22 by
|
September 29, 14 11:58:14 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -455,7 +455,7 @@ yatta.bind(textbox);</code></pre>
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 11:05:22 by
|
September 29, 14 11:58:14 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -252,7 +252,7 @@ This result can be send to other clients.</p>
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 11:05:22 by
|
September 29, 14 11:58:14 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 11:05:22 by
|
September 29, 14 11:58:14 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -70,7 +70,7 @@ But I would become really motivated if you gave me some feedback :) (<a href="ht
|
|||||||
<ul>
|
<ul>
|
||||||
<li>XML support</li>
|
<li>XML support</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h2 id="support">Support</h2><p>Please report any issues to the <a href="https://github.com/DadaMonad/Yatta/issues">Github issue page</a>!</p><h2 id="license">License</h2><p>Yatta! is licensed under the <a href="./LICENSE.txt">MIT License</a>.</p><a href="mailto:kevin.jahns@rwth-aachen.de">kevin.jahns@rwth-aachen.de</a>
|
<h2 id="support">Support</h2><p>Please report any issues to the <a href="https://github.com/DadaMonad/Yatta/issues">Github issue page</a>!</p><h2 id="license">License</h2><p>Yatta! is licensed under the <a href="./LICENSE.txt">MIT License</a>.</p><a href="mailto:kevin.jahns@rwth-aachen.de">kevin.jahns@rwth-aachen.de</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ But I would become really motivated if you gave me some feedback :) (<a href="ht
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 11:05:22 by
|
September 29, 14 11:58:14 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -100,7 +100,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 11:05:22 by
|
September 29, 14 11:58:14 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -158,7 +158,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 11:05:22 by
|
September 29, 14 11:58:14 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 11:05:22 by
|
September 29, 14 11:58:14 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 11:05:22 by
|
September 29, 14 11:58:14 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 11:05:22 by
|
September 29, 14 11:58:14 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 11:05:22 by
|
September 29, 14 11:58:14 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 11:05:22 by
|
September 29, 14 11:58:14 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 11:05:22 by
|
September 29, 14 11:58:14 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 11:05:22 by
|
September 29, 14 11:58:14 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 11:05:22 by
|
September 29, 14 11:58:14 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 11:05:22 by
|
September 29, 14 11:58:14 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -65,7 +65,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 11:05:22 by
|
September 29, 14 11:58:14 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 11:05:22 by
|
September 29, 14 11:58:14 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -43,6 +43,12 @@ createPeerJsConnector = ()->
|
|||||||
@peer.on 'connection', (conn)=>
|
@peer.on 'connection', (conn)=>
|
||||||
@addConnection conn
|
@addConnection conn
|
||||||
|
|
||||||
|
sync_every_collaborator = ()=>
|
||||||
|
for conn_id, conn of @connections
|
||||||
|
conn.send
|
||||||
|
sync_state_vector: @HB.getOperationCounter()
|
||||||
|
setInterval sync_every_collaborator, 8000
|
||||||
|
|
||||||
send_ = (o)=>
|
send_ = (o)=>
|
||||||
if o.uid.creator is @HB.getUserId() and (typeof o.uid.op_number isnt "string")
|
if o.uid.creator is @HB.getUserId() and (typeof o.uid.op_number isnt "string")
|
||||||
for conn_id,conn of @connections
|
for conn_id,conn of @connections
|
||||||
@ -50,6 +56,9 @@ createPeerJsConnector = ()->
|
|||||||
op: o
|
op: o
|
||||||
@execution_listener.push send_
|
@execution_listener.push send_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Connect the Framework to another peer. Therefore you have to receive his
|
# Connect the Framework to another peer. Therefore you have to receive his
|
||||||
# user_id. If the other peer is connected to other peers, the PeerJsConnector
|
# user_id. If the other peer is connected to other peers, the PeerJsConnector
|
||||||
@ -93,6 +102,7 @@ createPeerJsConnector = ()->
|
|||||||
else if data.HB?
|
else if data.HB?
|
||||||
initialized_me = true
|
initialized_me = true
|
||||||
@engine.applyOpsCheckDouble data.HB
|
@engine.applyOpsCheckDouble data.HB
|
||||||
|
if not data.initialized
|
||||||
conn.send
|
conn.send
|
||||||
conns: @getAllConnectionIds()
|
conns: @getAllConnectionIds()
|
||||||
else if data.op?
|
else if data.op?
|
||||||
@ -100,11 +110,17 @@ createPeerJsConnector = ()->
|
|||||||
else if data.conns?
|
else if data.conns?
|
||||||
for conn_id in data.conns
|
for conn_id in data.conns
|
||||||
@connectToPeer conn_id
|
@connectToPeer conn_id
|
||||||
|
else if data.sync_state_vector?
|
||||||
|
console.log "turinae"
|
||||||
|
conn.send
|
||||||
|
HB: @yatta.getHistoryBuffer()._encode(data.sync_state_vector)
|
||||||
|
initialized: true
|
||||||
else if data.state_vector?
|
else if data.state_vector?
|
||||||
if not initialized_him
|
if not initialized_him
|
||||||
# make sure, that it is sent only once
|
# make sure, that it is sent only once
|
||||||
conn.send
|
conn.send
|
||||||
HB: @yatta.getHistoryBuffer()._encode(data.state_vector)
|
HB: @yatta.getHistoryBuffer()._encode(data.state_vector)
|
||||||
|
initialized: false
|
||||||
initialized_him = true
|
initialized_him = true
|
||||||
else
|
else
|
||||||
throw new Error "Can't parse this operation"
|
throw new Error "Can't parse this operation"
|
||||||
|
@ -61,7 +61,8 @@ class Engine
|
|||||||
o = @parseOperation op_json
|
o = @parseOperation op_json
|
||||||
@HB.addToCounter o
|
@HB.addToCounter o
|
||||||
# @HB.addOperation o
|
# @HB.addOperation o
|
||||||
if not o.execute()
|
if @HB.getOperation(o)?
|
||||||
|
else if not o.execute()
|
||||||
@unprocessed_ops.push o
|
@unprocessed_ops.push o
|
||||||
else
|
else
|
||||||
@HB.addOperation o
|
@HB.addOperation o
|
||||||
@ -76,7 +77,8 @@ class Engine
|
|||||||
old_length = @unprocessed_ops.length
|
old_length = @unprocessed_ops.length
|
||||||
unprocessed = []
|
unprocessed = []
|
||||||
for op in @unprocessed_ops
|
for op in @unprocessed_ops
|
||||||
if not op.execute()
|
if @HB.getOperation(op)?
|
||||||
|
else if not op.execute()
|
||||||
unprocessed.push op
|
unprocessed.push op
|
||||||
else
|
else
|
||||||
@HB.addOperation op
|
@HB.addOperation op
|
||||||
|
Loading…
x
Reference in New Issue
Block a user