Skip to main content
Version: v2

Revertible Interface

Allows reversion of a change made to SharedTree.

Sealed

This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.

Signature​

/** @sealed */
export interface Revertible

Remarks​

Applications wanting to implement undo/redo support might typically maintain two stacks of Revertibles, with optional eviction policy to free up memory.

Properties​

PropertyModifiersTypeDescription
statusreadonlyRevertibleStatusThe current status of the revertible.

Methods​

MethodReturn TypeDescription
dispose()voidDisposes this revertible, allowing associated resources to be released.
revert()voidReverts the associated change and disposes it.
revert(dispose)voidReverts the associated change and optionally disposes it.

Property Details​

status​

The current status of the revertible.

Signature​

readonly status: RevertibleStatus;

Type: RevertibleStatus

Method Details​

dispose​

Disposes this revertible, allowing associated resources to be released.

Signature​

dispose(): void;

revert​

Reverts the associated change and disposes it.

Signature​

revert(): void;

Remarks​

Concurrent changes that are sequenced before the revert will not be overwritten by the revert if they affect different parts of the document.

revert​

Reverts the associated change and optionally disposes it.

Signature​

revert(dispose: boolean): void;

Remarks​

Concurrent changes that are sequenced before the revert will not be overwritten by the revert if they affect different parts of the document.

Parameters​

ParameterTypeDescription
disposebooleanIf true, the revertible will be disposed after being reverted. If false, the revertible will remain valid. This can be useful for scenarios where the revert may be dropped due to merge conflicts, and one wants to attempt reverting again.