cleanup, add fileContentHandler for ViewModel
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user