tests run fine. but it needs some more user testing

This commit is contained in:
Kevin Jahns
2014-10-02 21:14:37 +02:00
parent 968e07a8ff
commit 3415d0ee5e
56 changed files with 1329 additions and 457 deletions

View File

@@ -26,6 +26,7 @@
this.yatta = yatta;
this.peer = peer;
this.connections = {};
this.new_connection_listeners = [];
this.peer.on('connection', (function(_this) {
return function(conn) {
return _this.addConnection(conn);
@@ -80,6 +81,10 @@
return _results;
};
PeerJsConnector.prototype.onNewConnection = function(f) {
return this.new_connection_listeners.push(f);
};
PeerJsConnector.prototype.addConnection = function(conn) {
var initialized_him, initialized_me, sendStateVector;
this.connections[conn.peer] = conn;
@@ -94,9 +99,12 @@
initialized_me = true;
_this.engine.applyOpsCheckDouble(data.HB);
if (!data.initialized) {
return conn.send({
conn.send({
conns: _this.getAllConnectionIds()
});
return _this.new_connection_listeners.map(function(f) {
return f(conn);
});
}
} else if (data.op != null) {
return _this.engine.applyOp(data.op);

File diff suppressed because one or more lines are too long