documentatie

This commit is contained in:
2026-09-03 17:24:56 +02:00
parent e971dfe942
commit 42fcea9af8
14 changed files with 135 additions and 16 deletions
@@ -49,6 +49,10 @@ export class CmapStorageController {
}
}
/**
* goal : Queue one delayed autosave for the current dirty CMap.
* post : Any preceding autosave timer is replaced; non-editable or clean maps are not queued.
*/
scheduleAutosave() {
this.cancelAutosave();
if (!this.canEdit() || !this.getCurrentMap() || !this.hasUnsavedChanges()) return;
@@ -59,6 +63,10 @@ export class CmapStorageController {
}, 1500);
}
/**
* goal : Guard a route or view transition while unsaved CMap changes exist.
* result : True only when the action ran after saving, discarding or finding no changes.
*/
async requestTransition(action) {
if (!this.hasUnsavedChanges()) {
await action();
@@ -93,6 +101,11 @@ export class CmapStorageController {
if (this.savePromise) await this.savePromise;
}
/**
* goal : Persist the active editor model and its derived SVG render in one ordered workflow.
* post : A successful save updates the current map, saved snapshot and CMap catalogue.
* result : False for cancellation, unavailable editor or persistence failure.
*/
async save({ automatic = false, force = false, summary = null,
snapshotVersion = false, historyMode = null } = {}) {
const editor = this.getEditor();