add default info db and recreate clear function for info

This commit is contained in:
Yokozuna59 2023-06-14 13:48:39 +03:00
parent 750b1d2223
commit 6af2438474
2 changed files with 10 additions and 3 deletions

View File

@ -1,7 +1,6 @@
import { clear } from '../../commonDb.js';
import type { InfoDB } from './infoTypes.js';
import { DEFAULT_INFO_DB, type InfoDB } from './infoTypes.js';
let info = false;
let info: boolean = DEFAULT_INFO_DB.info;
export const setInfo = (toggle: boolean): void => {
info = toggle;
@ -9,6 +8,10 @@ export const setInfo = (toggle: boolean): void => {
export const getInfo = (): boolean => info;
const clear = (): void => {
info = DEFAULT_INFO_DB.info;
};
const db: InfoDB = {
clear,
setInfo,

View File

@ -1,5 +1,9 @@
import type { DiagramDB } from '../../diagram-api/types.js';
export const DEFAULT_INFO_DB = {
info: false,
} as const;
export interface InfoDB extends DiagramDB {
clear: () => void;
setInfo: (info: boolean) => void;