tests run fine. but it needs some more user testing
This commit is contained in:
@@ -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
Reference in New Issue
Block a user