Skip to content

@Memento

Snapshot / restore — capture deep-cloned state and roll back without a full undo stack.

KindRuntime
Backendslegacy, stage3
Requires generateNo

Example

ts
import { Memento } from 'lombok-typescript/legacy';

@Memento
class Editor {
  content = '';
  @Memento.Exclude
  cache = new Map<string, unknown>();
}

const editor = new Editor();
editor.content = 'Hello';
const snap = editor.save();
editor.content = 'oops';
editor.restore(snap);

Excluded fields are not stored in the snapshot and are not restored.

Released under the MIT License.