start home page and settings
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
export const DATA_VERSION = "v2"
|
||||
|
||||
export function checkIsValidObject(object: any): boolean {
|
||||
return object.dataVersion == DATA_VERSION;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// date
|
||||
export function createTimestamp(): string {
|
||||
return new Date().toISOString();
|
||||
}
|
||||
|
||||
// string
|
||||
export function stringify(data: any): string {
|
||||
return JSON.stringify(data);
|
||||
}
|
||||
|
||||
export function parse(string: string): any {
|
||||
return JSON.parse(string);
|
||||
}
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
import StorageModel, { storageKeys } from "./storageModel";
|
||||
|
||||
import { checkIsValidObject } from "../typeSafety";
|
||||
import { createTimestamp } from "../utility";
|
||||
import { checkIsValidObject } from "./Utility/typeSafety";
|
||||
import { createTimestamp } from "./Utility/utility";
|
||||
import { v4 } from "uuid";
|
||||
|
||||
export class ChatModel {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import UDNFrontend, { Message } from "udn-frontend";
|
||||
|
||||
import { ChatMessage } from "./chatModel";
|
||||
import { stringify } from "../utility";
|
||||
import { stringify } from "./Utility/utility";
|
||||
|
||||
export default class ConnectionModel {
|
||||
// basic
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// this file is responsible for reading and writing persistent data; all storage shall be handled by this file.
|
||||
|
||||
import { parse, stringify } from "../utility";
|
||||
import { parse, stringify } from "./Utility/utility";
|
||||
|
||||
import { DATA_VERSION } from "../typeSafety";
|
||||
import { DATA_VERSION } from "./Utility/typeSafety";
|
||||
|
||||
export default class StorageModel {
|
||||
storageEntryTree: StorageEntry = {};
|
||||
|
||||
Reference in New Issue
Block a user