Skip to content

Commit d9f6722

Browse files
committed
wip
1 parent 7eabcfa commit d9f6722

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/data/model/CascadedInvalidateOp.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { Hash } from "./Hashing";
55
import { HashReference } from "./HashReference";
66
import { InvalidateAfterOp } from "./InvalidateAfterOp";
77
import { MutationOp } from "./MutationOp";
8+
import { RedoOp } from "./RedoOp";
9+
import { UndoOp } from "./UndoOp";
810

911
/*
1012
* Op0 <-
@@ -249,7 +251,7 @@ abstract class CascadedInvalidateOp extends MutationOp {
249251
return false;
250252
}
251253
}
252-
254+
253255
return true;
254256
}
255257

@@ -278,6 +280,14 @@ abstract class CascadedInvalidateOp extends MutationOp {
278280

279281
}
280282

283+
static createFromBoolean(undo: boolean, causalOp: InvalidateAfterOp|CascadedInvalidateOp, targetOp: MutationOp): CascadedInvalidateOp {
284+
if (undo) {
285+
return new UndoOp(causalOp, targetOp);
286+
} else {
287+
return new RedoOp(causalOp, targetOp);
288+
}
289+
}
290+
281291
}
282292

283293
export { CascadedInvalidateOp };

src/data/model/UndoOp.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ class UndoOp extends CascadedInvalidateOp {
1313
constructor(causalOp?: InvalidateAfterOp|UndoOp|RedoOp, targetOp?: MutationOp) {
1414
super(true, causalOp, targetOp);
1515
}
16-
17-
18-
16+
1917
getClassName() {
2018
return UndoOp.className;
2119
}

0 commit comments

Comments
 (0)