added offline editing demo 🌟

This commit is contained in:
Kevin Jahns
2015-10-18 03:07:34 +02:00
parent 04139d3b7e
commit 29f3f3f722
11 changed files with 165 additions and 48 deletions

View File

@@ -132,6 +132,7 @@ class Transaction {
*/
* deleteOperation (targetId, preventCallType) {
var target = yield* this.getOperation(targetId)
var callType = false
if (target == null || !target.deleted) {
yield* this.markDeleted(targetId)
@@ -139,8 +140,10 @@ class Transaction {
if (target != null && target.gc == null) {
if (!target.deleted) {
callType = true
// set deleted & notify type
target.deleted = true
/*
if (!preventCallType) {
var type = this.store.initializedTypes[JSON.stringify(target.parent)]
if (type != null) {
@@ -150,6 +153,7 @@ class Transaction {
})
}
}
*/
// delete containing lists
if (target.start != null) {
// TODO: don't do it like this .. -.-
@@ -187,6 +191,7 @@ class Transaction {
) {
yield* this.setOperation(right)
}
return callType
}
}
/*
@@ -468,7 +473,11 @@ class Transaction {
var del = deletions[i]
var id = [del[0], del[1]]
// always try to delete..
yield* this.deleteOperation(id)
var addOperation = yield* this.deleteOperation(id)
if (addOperation) {
// TODO:.. really .. here? You could prevent calling all these functions in operationAdded
yield* this.store.operationAdded(this, {struct: 'Delete', target: id})
}
if (del[2]) {
// gc
yield* this.garbageCollectOperation(id)