fixed some example issues

This commit is contained in:
Kevin Jahns 2015-10-12 15:59:22 +02:00
parent e32aef4c9f
commit 51e20fb9c7
4 changed files with 15 additions and 4 deletions

View File

@ -140,6 +140,10 @@ gulp.task('dev:browser', ['build:test'], function () {
.pipe(jasmineBrowser.server({port: options.testport})) .pipe(jasmineBrowser.server({port: options.testport}))
}) })
gulp.task('dev:deploy', ['build:deploy'], function () {
gulp.watch('src/**/*.js', ['build:deploy'])
})
gulp.task('dev', ['build:test'], function () { gulp.task('dev', ['build:test'], function () {
gulp.start('dev:browser') gulp.start('dev:browser')
gulp.start('dev:node') gulp.start('dev:node')

View File

@ -83,6 +83,9 @@ class WebRTC extends Y.AbstractConnector {
broadcast (message) { broadcast (message) {
this.swr.sendDirectlyToAll('simplewebrtc', 'yjs', message) this.swr.sendDirectlyToAll('simplewebrtc', 'yjs', message)
} }
isDisconnected () {
return false
}
} }
Y.WebRTC = WebRTC Y.WebRTC = WebRTC

View File

@ -305,9 +305,9 @@ class AbstractOperationStore {
} }
os.gc2 = os.gc1 os.gc2 = os.gc1
os.gc1 = [] os.gc1 = []
if (os.gcTimeout > 0) { }
os.gcInterval = setTimeout(garbageCollect, os.gcTimeout) if (os.gcTimeout > 0) {
} os.gcInterval = setTimeout(garbageCollect, os.gcTimeout)
} }
resolve() resolve()
}) })
@ -490,7 +490,7 @@ class AbstractOperationStore {
* tryExecute (op) { * tryExecute (op) {
if (op.struct === 'Delete') { if (op.struct === 'Delete') {
yield* Y.Struct.Delete.execute.call(this, op) yield* Y.Struct.Delete.execute.call(this, op)
} else if ((yield* this.getOperation(op.id)) == null) { } else if ((yield* this.getOperation(op.id)) == null && !this.store.ds.isGarbageCollected(op.id)) {
yield* Y.Struct[op.struct].execute.call(this, op) yield* Y.Struct[op.struct].execute.call(this, op)
var next = yield* this.addOperation(op) var next = yield* this.addOperation(op)
yield* this.store.operationAdded(this, op, next) yield* this.store.operationAdded(this, op, next)

View File

@ -10,6 +10,10 @@ class DeleteStore extends Y.utils.RBTree {
var n = this.findNodeWithUpperBound(id) var n = this.findNodeWithUpperBound(id)
return n !== null && n.val.id[0] === id[0] && id[1] < n.val.id[1] + n.val.len return n !== null && n.val.id[0] === id[0] && id[1] < n.val.id[1] + n.val.len
} }
isGarbageCollected (id) {
var n = this.findNodeWithUpperBound(id)
return n !== null && n.val.id[0] === id[0] && id[1] < n.val.id[1] + n.val.len && n.val.gc
}
/* /*
Mark an operation as deleted&gc'd Mark an operation as deleted&gc'd