Update telepath

This commit is contained in:
Corey Johnson & Nathan Sobo
2013-08-13 15:55:40 -07:00
parent 2597837ba7
commit 2d46a98ea2
3 changed files with 6 additions and 6 deletions

View File

@@ -39,13 +39,13 @@ module.exports =
event.id = nextOutputEventId++
console.log 'sending event', event.id, event
connection.send(event)
doc.on('replicate-change', outputListener)
doc.on('replicate-patch', outputListener)
queuedEvents = []
nextInputEventId = 1
handleInputEvent = (event) ->
console.log 'received event', event.id, event
doc.applyRemoteChange(event)
doc.applyPatch(event)
nextInputEventId = event.id + 1
flushQueuedEvents = ->
loop
@@ -66,7 +66,7 @@ module.exports =
queuedEvents.push(event)
connection.on 'close', ->
doc.off('replicate-change', outputListener)
doc.off('replicate-patch', outputListener)
connection.on 'error', (error) ->
console.error 'connection error', error.stack ? error

View File

@@ -163,7 +163,7 @@ class Session
event.site = window.site.id
connectDocument: ->
@doc.on 'replicate-change', (event) =>
@doc.on 'replicate-patch', (event) =>
@stampEvent(event)
console.log "sending replication event", event
@channel.broadcast('document-changed', event)
@@ -171,7 +171,7 @@ class Session
@channel.on 'document-changed', (event) =>
console.log "receiving replication event", event
@verifyEvent(event)
@doc.applyRemoteChange(event)
@doc.applyPatch(event)
snapshotRepository: (callback) ->
patrick.snapshot project.getPath(), (error, repoSnapshot) =>