mirror of
https://github.com/yjs/yjs.git
synced 2025-12-29 00:25:01 +01:00
support for the new connector version
This commit is contained in:
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
@@ -14,9 +14,16 @@ adaptConnector = (connector, engine, HB, execution_listener)->
|
||||
sendStateVector = ()->
|
||||
HB.getOperationCounter()
|
||||
sendHb = (state_vector)->
|
||||
HB._encode(state_vector)
|
||||
json = HB._encode(state_vector)
|
||||
if json.length > 0
|
||||
json
|
||||
else
|
||||
null
|
||||
applyHb = (hb)->
|
||||
engine.applyOpsCheckDouble hb
|
||||
if hb?
|
||||
engine.applyOpsCheckDouble hb
|
||||
else
|
||||
null
|
||||
connector.whenSyncing sendStateVector, sendHb, applyHb
|
||||
|
||||
connector.whenReceiving (sender, op)->
|
||||
|
||||
@@ -18,15 +18,20 @@ class HistoryBuffer
|
||||
@garbage = [] # Will be cleaned on next call of garbageCollector
|
||||
@trash = [] # Is deleted. Wait until it is not used anymore.
|
||||
@performGarbageCollection = true
|
||||
@garbageCollectTimeout = 1000
|
||||
@garbageCollectTimeout = 30000
|
||||
@reserved_identifier_counter = 0
|
||||
setTimeout @emptyGarbage, @garbageCollectTimeout
|
||||
|
||||
resetUserId: (id)->
|
||||
own = @buffer[@user_id]
|
||||
if own?
|
||||
for o in own
|
||||
for o_name,o of own
|
||||
o.uid.creator = id
|
||||
if @buffer[id]?
|
||||
throw new Error "You are re-assigning an old user id - this is not (yet) possible!"
|
||||
@buffer[id] = own
|
||||
delete @buffer[@user_id]
|
||||
|
||||
@operation_counter[id] = @operation_counter[@user_id]
|
||||
delete @operation_counter[@user_id]
|
||||
@user_id = id
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user