The store of the transactional root to track. A freshly read / created root is clean (the bookmark is initialized to the current commit).
OptionalcommitSource: ITransaction.ICommitSource
Optional source of durable-commit notifications (e.g. WorkbookIO). When
given, a matching persist (same store) marks this manager clean — no per-consumer wiring.
Add a set of callbacks to receive notification.
The callbacks object.
Optionaloptions: IListener.Options
Options
A function that can be called to remove the listener.
Detach the store / commit listeners and release listeners.
The commit id currently treated as saved, or null.
The store this manager tracks.
true when the current commit differs from the saved bookmark.
Move the saved bookmark, marking the root clean as of commitId.
The commit that was persisted. Defaults to the current commit.
Tracks whether a transactional root — a
Workbook, or a standaloneSheet— has unsaved changes, by comparing the store's current commit against a saved bookmark commit.Remarks
A peer to TransactionUndoManager: both attach to an ITransaction.IStore and interpret its commits. This one answers "am I dirty relative to the last save?".
Dirty is a pure commit-id comparison, which has two nice consequences for free:
It is consumer-owned: construct it, and call close when done. It is intentionally never attached to the model. Pass an ITransaction.ICommitSource (e.g.
WorkbookIO) and it marks itself clean automatically on a matching persist; otherwise call markSaved directly.