frontend/src/app/components/nodes/EditorNode.contract.ts

46 lines
1010 B
TypeScript
Raw Normal View History

2020-10-13 16:57:56 +00:00
import PageRecord from '../../structures/PageRecord';
import HostRecord from '../../structures/HostRecord';
2020-10-13 16:57:56 +00:00
export abstract class EditorNodeContract {
protected pageRec!: PageRecord;
protected nodeRec!: HostRecord;
protected initialValue: any;
2020-10-13 16:57:56 +00:00
get page() {
return this.pageRec;
}
set page(page: PageRecord) {
this.pageRec = page;
}
get node() {
return this.nodeRec;
}
set node(node: HostRecord) {
this.nodeRec = node;
}
2020-10-13 16:57:56 +00:00
get identifier() {
return this.nodeRec.UUID;
}
public abstract isDirty(): boolean | Promise<boolean>;
public abstract writeChangesToNode(): void | Promise<void>;
2020-10-13 16:57:56 +00:00
public needsSave(): boolean | Promise<boolean> {
return false;
}
public needsLoad(): boolean | Promise<boolean> {
return false;
}
public performSave(): void | Promise<void> {}
public performLoad(): void | Promise<void> {}
2020-10-14 03:47:59 +00:00
public performDelete(): void | Promise<void> {}
2020-10-13 16:57:56 +00:00
}