Skip to main content

Revertible Interface

Allows reversion of a change made to SharedTree.

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

Property Modifiers Type Description
status readonly RevertibleStatus The current status of the revertible.

Methods

Method Return Type Description
dispose() void Disposes this revertible, allowing associated resources to be released.
revert() void Reverts the associated change and disposes it.
revert(dispose) void Reverts 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;

revert

Reverts the associated change and optionally disposes it.

Signature

revert(dispose: boolean): void;

Parameters

Parameter Type Description
dispose boolean If 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.