standardize arrow functions, use implicit types where applicable
This commit is contained in:
@@ -15,7 +15,7 @@ export default class ChatListModel {
|
|||||||
connectionModel: ConnectionModel;
|
connectionModel: ConnectionModel;
|
||||||
|
|
||||||
// data
|
// data
|
||||||
chatModels = new Set<ChatModel>();
|
chatModels: Set<ChatModel> = new Set<ChatModel>();
|
||||||
|
|
||||||
// handlers
|
// handlers
|
||||||
messageHandler = (data: Message): void => {
|
messageHandler = (data: Message): void => {
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import {
|
|||||||
HandlerManager,
|
HandlerManager,
|
||||||
createTimestamp,
|
createTimestamp,
|
||||||
localeCompare,
|
localeCompare,
|
||||||
parse,
|
|
||||||
parseValidObject,
|
parseValidObject,
|
||||||
stringify,
|
stringify,
|
||||||
} from "../Utility/utility";
|
} from "../Utility/utility";
|
||||||
|
|||||||
@@ -23,9 +23,8 @@ export default class BoardsAndTasksModel {
|
|||||||
calendarModel: CalendarModel;
|
calendarModel: CalendarModel;
|
||||||
|
|
||||||
// data
|
// data
|
||||||
boardHandlerManager: HandlerManager<BoardInfoFileContent> =
|
boardHandlerManager = new HandlerManager<BoardInfoFileContent>();
|
||||||
new HandlerManager();
|
taskHandlerManager = new HandlerManager<TaskFileContent>();
|
||||||
taskHandlerManager: HandlerManager<TaskFileContent> = new HandlerManager();
|
|
||||||
|
|
||||||
// paths
|
// paths
|
||||||
getBasePath = (): string[] => {
|
getBasePath = (): string[] => {
|
||||||
|
|||||||
@@ -20,12 +20,10 @@ export default class ConnectionModel {
|
|||||||
return this.udn.ws?.url;
|
return this.udn.ws?.url;
|
||||||
}
|
}
|
||||||
|
|
||||||
connectionChangeHandlerManager: HandlerManager<void> = new HandlerManager();
|
connectionChangeHandlerManager = new HandlerManager<void>();
|
||||||
messageHandlerManager: HandlerManager<Message> = new HandlerManager();
|
messageHandlerManager = new HandlerManager<Message>();
|
||||||
messageSentHandlerManager: HandlerManager<ChatMessage> =
|
messageSentHandlerManager = new HandlerManager<ChatMessage>();
|
||||||
new HandlerManager();
|
channelsToSubscribe = new Set<string>();
|
||||||
|
|
||||||
channelsToSubscribe: Set<string> = new Set();
|
|
||||||
|
|
||||||
// handlers
|
// handlers
|
||||||
handleMessage = (data: Message): void => {
|
handleMessage = (data: Message): void => {
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ export default class FileTransferModel {
|
|||||||
static READY_MESSAGE = "ready";
|
static READY_MESSAGE = "ready";
|
||||||
|
|
||||||
// data
|
// data
|
||||||
transferData: TransferData | undefined;
|
transferData: TransferData | undefined = undefined;
|
||||||
fileHandlerManager: HandlerManager<string> = new HandlerManager();
|
fileHandlerManager = new HandlerManager<string>();
|
||||||
readyToSendHandlerManager: HandlerManager<boolean> = new HandlerManager();
|
readyToSendHandlerManager = new HandlerManager<boolean>();
|
||||||
direction: TransferDirections = TransferDirections.Send;
|
direction: TransferDirections = TransferDirections.Send;
|
||||||
|
|
||||||
// general
|
// general
|
||||||
|
|||||||
@@ -23,30 +23,30 @@ export default class SettingsModel {
|
|||||||
this.storageModel.write(path, value);
|
this.storageModel.write(path, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
setName(newValue: string): void {
|
setName = (newValue: string): void => {
|
||||||
this.username = newValue;
|
this.username = newValue;
|
||||||
this.storeSetting("username", newValue);
|
this.storeSetting("username", newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
setFirstDayOfWeek(newValue: string): void {
|
setFirstDayOfWeek = (newValue: string): void => {
|
||||||
this.firstDayOfWeek = newValue;
|
this.firstDayOfWeek = newValue;
|
||||||
this.storeSetting("firstDayOfWeek", newValue);
|
this.storeSetting("firstDayOfWeek", newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
setLanguage(newValue: string): void {
|
setLanguage = (newValue: string): void => {
|
||||||
this.language = newValue;
|
this.language = newValue;
|
||||||
this.storeSetting("language", newValue);
|
this.storeSetting("language", newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
setTheme(newValue: string): void {
|
setTheme = (newValue: string): void => {
|
||||||
this.theme = newValue;
|
this.theme = newValue;
|
||||||
this.storeSetting("theme", newValue);
|
this.storeSetting("theme", newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
// load
|
// load
|
||||||
private readSetting(
|
private readSetting = (
|
||||||
pathName: keyof typeof filePaths.settingsModel,
|
pathName: keyof typeof filePaths.settingsModel,
|
||||||
): string {
|
): string => {
|
||||||
const path = StorageModel.getPath(
|
const path = StorageModel.getPath(
|
||||||
StorageModelSubPaths.SettingsModel,
|
StorageModelSubPaths.SettingsModel,
|
||||||
filePaths.settingsModel[pathName],
|
filePaths.settingsModel[pathName],
|
||||||
@@ -54,22 +54,22 @@ export default class SettingsModel {
|
|||||||
return this.storageModel.read(path);
|
return this.storageModel.read(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadUsername(): void {
|
loadUsername = (): void => {
|
||||||
const content = this.readSetting("username");
|
const content = this.readSetting("username");
|
||||||
this.username = content ?? "";
|
this.username = content ?? "";
|
||||||
}
|
}
|
||||||
|
|
||||||
loadFirstDayofWeek(): void {
|
loadFirstDayofWeek = (): void => {
|
||||||
const content = this.readSetting("firstDayOfWeek");
|
const content = this.readSetting("firstDayOfWeek");
|
||||||
this.firstDayOfWeek = content ?? "0";
|
this.firstDayOfWeek = content ?? "0";
|
||||||
}
|
}
|
||||||
|
|
||||||
loadLanguage(): void {
|
loadLanguage = (): void => {
|
||||||
const content = this.readSetting("language");
|
const content = this.readSetting("language");
|
||||||
this.language = content ?? SettingsModel.getSystemLanguage();
|
this.language = content ?? SettingsModel.getSystemLanguage();
|
||||||
}
|
}
|
||||||
|
|
||||||
loadTheme(): void {
|
loadTheme = (): void => {
|
||||||
const content = this.readSetting("theme");
|
const content = this.readSetting("theme");
|
||||||
this.theme = content ?? ThemeSettings.System;
|
this.theme = content ?? ThemeSettings.System;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ export function checkDoesObjectMatchSearch<T>(
|
|||||||
export type Handler<T> = (item: T) => void;
|
export type Handler<T> = (item: T) => void;
|
||||||
|
|
||||||
export class HandlerManager<T> {
|
export class HandlerManager<T> {
|
||||||
handlers: Set<Handler<T>> = new Set();
|
handlers = new Set<Handler<T>>();
|
||||||
|
|
||||||
// manage
|
// manage
|
||||||
addHandler = (handler: Handler<T>): void => {
|
addHandler = (handler: Handler<T>): void => {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export default class ChatListViewModel {
|
|||||||
notificationViewModel: NotificationViewModel;
|
notificationViewModel: NotificationViewModel;
|
||||||
|
|
||||||
// data
|
// data
|
||||||
chatIndexManager: IndexManager<ChatViewModel> = new IndexManager(
|
chatIndexManager = new IndexManager<ChatViewModel>(
|
||||||
(chatViewModel: ChatViewModel) =>
|
(chatViewModel: ChatViewModel) =>
|
||||||
chatViewModel.settingsPageViewModel.primaryChannel.value,
|
chatViewModel.settingsPageViewModel.primaryChannel.value,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import CoreViewModel, { Context } from "./coreViewModel";
|
|||||||
import { CommonKeys } from "../../View/keystrokes";
|
import { CommonKeys } from "../../View/keystrokes";
|
||||||
|
|
||||||
export default class FileTransferViewModel extends Context {
|
export default class FileTransferViewModel extends Context {
|
||||||
contextDebugDescription = "transfer";
|
contextDebugDescription: string = "transfer";
|
||||||
|
|
||||||
// state
|
// state
|
||||||
presentedModal: React.State<FileTransferModals | undefined> =
|
presentedModal: React.State<FileTransferModals | undefined> =
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { Languages, ThemeSettings } from "../../Model/Global/settingsModel";
|
|||||||
import { CommonKeys } from "../../View/keystrokes";
|
import { CommonKeys } from "../../View/keystrokes";
|
||||||
|
|
||||||
export default class SettingsViewModel extends Context {
|
export default class SettingsViewModel extends Context {
|
||||||
contextDebugDescription = "settings";
|
contextDebugDescription: string = "settings";
|
||||||
|
|
||||||
// state
|
// state
|
||||||
username: React.State<string> = new React.State("");
|
username: React.State<string> = new React.State("");
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import TaskViewModel from "./taskViewModel";
|
|||||||
import { CommonKeys } from "../../View/keystrokes";
|
import { CommonKeys } from "../../View/keystrokes";
|
||||||
|
|
||||||
export default class BoardViewModel extends TaskContainingPageViewModel {
|
export default class BoardViewModel extends TaskContainingPageViewModel {
|
||||||
contextDebugDescription = "board";
|
contextDebugDescription: string = "board";
|
||||||
|
|
||||||
// state
|
// state
|
||||||
name: React.State<string> = new React.State("");
|
name: React.State<string> = new React.State("");
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import TaskViewModel from "./taskViewModel";
|
|||||||
|
|
||||||
export default class TaskContainingPageViewModel extends Context {
|
export default class TaskContainingPageViewModel extends Context {
|
||||||
// state
|
// state
|
||||||
taskIndexManager: IndexManager<TaskViewModel> = new IndexManager(
|
taskIndexManager = new IndexManager<TaskViewModel>(
|
||||||
(taskViewModel: TaskViewModel) => taskViewModel.sortingString,
|
(taskViewModel: TaskViewModel) => taskViewModel.sortingString,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ import { IndexManager } from "../../Model/Utility/utility";
|
|||||||
import { CommonKeys } from "../../View/keystrokes";
|
import { CommonKeys } from "../../View/keystrokes";
|
||||||
|
|
||||||
export default class TaskPageViewModel extends ContextHost<string> {
|
export default class TaskPageViewModel extends ContextHost<string> {
|
||||||
contextDebugDescription = "task-page";
|
contextDebugDescription: string = "task-page";
|
||||||
|
|
||||||
// data
|
// data
|
||||||
boardIndexManager: IndexManager<BoardViewModel> = new IndexManager(
|
boardIndexManager = new IndexManager<BoardViewModel>(
|
||||||
(boardViewModel: BoardViewModel) => boardViewModel.name.value,
|
(boardViewModel: BoardViewModel) => boardViewModel.name.value,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export default class TaskPropertyBulkChangeViewModel {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
setValue: (newValue: string, taskViewModel: TaskViewModel) => void;
|
setValue: (newValue: string, taskViewModel: TaskViewModel) => void = () => {};
|
||||||
|
|
||||||
// init
|
// init
|
||||||
constructor(
|
constructor(
|
||||||
|
|||||||
Reference in New Issue
Block a user