cleanup, add fileContentHandler for ViewModel

This commit is contained in:
marlon-erler
2024-07-23 00:25:28 +02:00
parent 224c00c8d8
commit 39b50e9254
6 changed files with 109 additions and 49 deletions
+9 -1
View File
@@ -9,7 +9,6 @@ import {
} from "../Utility/utility";
import ChatModel from "../Chat/chatModel";
import { Color } from "../../colors";
import TaskModel from "./taskModel";
import { v4 } from "uuid";
@@ -19,6 +18,9 @@ export default class FileModel {
taskModel: TaskModel;
fileContentHandler: (fileContent: FileContent<string>) => void = () => {};
// paths
getBasePath = (): string[] => {
return StorageModel.getPath(
@@ -62,6 +64,7 @@ export default class FileModel {
if (didStore == false) return;
this.taskModel.handleFileContent(fileContent);
this.fileContentHandler(fileContent);
};
// methods
@@ -132,6 +135,11 @@ export default class FileModel {
return fileContent;
};
// other
setFileContentHandler = (handler: (fileContent: FileContent<string>) => void): void => {
this.fileContentHandler = handler;
};
// init
constructor(chatModel: ChatModel, storageModel: StorageModel) {
this.chatModel = chatModel;