Skip to main content

Editor.Model.ProjectSaveMode

Enum

Enum controlling how and when a project is saved.

Index

Enumeration Members

Example

// ProjectSaveMode is delivered as the first argument of the
// IModel.onProjectSaving signal, which fires after the project has been
// saved. Use the mode to tell a user-triggered save apart from an
// automatic background save.
// Default — save initiated by the user (File > Save / Cmd+S, or
// Save As to a new path). Safe place for side effects like
// stamping a version or refreshing UI tied to the on-disk path.
// Autosave — automatic periodic save. Keep the handler cheap.
const model = this.pluginSystem.findInterface(Editor.Model.IModel) as Editor.Model.IModel;

const conn = model.onProjectSaving.connect(
(mode: Editor.Model.ProjectSaveMode, path: Editor.Path) => {
if (mode === Editor.Model.ProjectSaveMode.Default) {
console.log(`User save committed -> ${path.toString()}`);
} else if (mode === Editor.Model.ProjectSaveMode.Autosave) {
console.log(`Autosave committed -> ${path.toString()}`);
}
}
);
this.connections.push(conn);

Enumeration Members

Autosave

Autosave: number

Automatic save mode that persists changes without user intervention.


Default

Default: number

Standard save mode triggered by user action.