updated connector functionality
This commit is contained in:
parent
7c842efd52
commit
cbcdebf33e
@ -34,7 +34,7 @@ Either clone this git repository, install it with [bower](http://bower.io/), or
|
||||
|
||||
### Bower
|
||||
```
|
||||
bower install yjs
|
||||
bower install rwth-acis/yjs
|
||||
```
|
||||
Then you include the libraries directly from the installation folder.
|
||||
```
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -55,14 +55,12 @@ adaptConnector = function(connector, engine, HB, execution_listener) {
|
||||
connector.getStateVector = getStateVector;
|
||||
connector.getHB = getHB;
|
||||
connector.applyHB = applyHB;
|
||||
connector.whenReceiving(function(sender, op) {
|
||||
connector.receive_handlers.push(function(sender, op) {
|
||||
if (op.uid.creator !== HB.getUserId()) {
|
||||
return engine.applyOp(op);
|
||||
}
|
||||
});
|
||||
if (connector._whenBoundToY != null) {
|
||||
return connector._whenBoundToY();
|
||||
}
|
||||
return connector.setIsBoundToY();
|
||||
};
|
||||
|
||||
module.exports = adaptConnector;
|
||||
|
@ -17,7 +17,7 @@ createY = function(connector) {
|
||||
user_id = connector.id;
|
||||
} else {
|
||||
user_id = "_temp";
|
||||
connector.whenUserIdSet(function(id) {
|
||||
connector.onUserIdSet(function(id) {
|
||||
user_id = id;
|
||||
return HB.resetUserId(id);
|
||||
});
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -46,11 +46,10 @@ adaptConnector = (connector, engine, HB, execution_listener)->
|
||||
connector.getHB = getHB
|
||||
connector.applyHB = applyHB
|
||||
|
||||
connector.whenReceiving (sender, op)->
|
||||
connector.receive_handlers.push (sender, op)->
|
||||
if op.uid.creator isnt HB.getUserId()
|
||||
engine.applyOp op
|
||||
|
||||
if connector._whenBoundToY?
|
||||
connector._whenBoundToY()
|
||||
connector.setIsBoundToY()
|
||||
|
||||
module.exports = adaptConnector
|
@ -10,7 +10,7 @@ createY = (connector)->
|
||||
user_id = connector.id # TODO: change to getUniqueId()
|
||||
else
|
||||
user_id = "_temp"
|
||||
connector.whenUserIdSet (id)->
|
||||
connector.onUserIdSet (id)->
|
||||
user_id = id
|
||||
HB.resetUserId id
|
||||
HB = new HistoryBuffer user_id
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user