This commit is contained in:
Kevin Jahns
2016-04-05 15:38:22 +02:00
parent 1c32067908
commit ecc2aef0f8
5 changed files with 80 additions and 62 deletions

View File

@@ -216,11 +216,15 @@ module.exports = function (Y /* :any */) {
whenUserIdSet (f) {
this.userIdPromise.then(f)
}
getNextOpId () {
if (this.userId == null) {
getNextOpId (numberOfIds) {
if (numberOfIds == null) {
throw new Error('getNextOpId expects the number of created ids to create!')
} else if (this.userId == null) {
throw new Error('OperationStore not yet initialized!')
} else {
return [this.userId, this.opClock++]
var id = [this.userId, this.opClock]
this.opClock += numberOfIds
return id
}
}
/*
@@ -294,7 +298,7 @@ module.exports = function (Y /* :any */) {
for (var sid in ls) {
var l = ls[sid]
var id = JSON.parse(sid)
var op = yield* this.getOperation(id)
var op = yield* this.getInsertion(id)
if (op == null) {
store.listenersById[sid] = l
} else {