config.ts (f415a09ce8caca2079aeb12f568d6450698de84e) | config.ts (cfa0fc0757dad620cd0b0533a949d86b17086d32) |
---|---|
1import {getStorage, setStorage} from '@/utils/storage'; 2import produce from 'immer'; 3import {useEffect, useState} from 'react'; 4 5type ExceptionType = IMusic.IMusicItem | IMusic.IMusicItem[]; 6interface IConfig { 7 setting: { 8 basic: { | 1import {getStorage, setStorage} from '@/utils/storage'; 2import produce from 'immer'; 3import {useEffect, useState} from 'react'; 4 5type ExceptionType = IMusic.IMusicItem | IMusic.IMusicItem[]; 6interface IConfig { 7 setting: { 8 basic: { |
9 /** 使用移动网络播放 */ 10 useCelluarNetworkPlay: boolean; 11 /** 使用移动网络下载 */ 12 useCelluarNetworkDownload: boolean; |
|
9 /** 最大同时下载 */ 10 maxDownload: number | string; 11 /** 同时播放 */ 12 notInterrupt: boolean; 13 /** 播放错误时自动停止 */ 14 autoStopWhenError: boolean; | 13 /** 最大同时下载 */ 14 maxDownload: number | string; 15 /** 同时播放 */ 16 notInterrupt: boolean; 17 /** 播放错误时自动停止 */ 18 autoStopWhenError: boolean; |
19 /** 插件缓存策略 todo */ 20 pluginCacheControl: string; 21 /** 最大音乐缓存 */ 22 maxCacheSize: number; |
|
15 16 debug: { 17 errorLog: boolean; 18 traceLog: boolean; 19 }; 20 }; 21 22 /** 主题 */ --- 68 unchanged lines hidden (view full) --- 91type DeepPartial<T> = { 92 [K in keyof T]?: T[K] extends Record<string | number, any> 93 ? T[K] extends ExceptionType 94 ? T[K] 95 : DeepPartial<T[K]> 96 : T[K]; 97}; 98 | 23 24 debug: { 25 errorLog: boolean; 26 traceLog: boolean; 27 }; 28 }; 29 30 /** 主题 */ --- 68 unchanged lines hidden (view full) --- 99type DeepPartial<T> = { 100 [K in keyof T]?: T[K] extends Record<string | number, any> 101 ? T[K] extends ExceptionType 102 ? T[K] 103 : DeepPartial<T[K]> 104 : T[K]; 105}; 106 |
99type IConfigPaths = KeyPaths<IConfig>; | 107export type IConfigPaths = KeyPaths<IConfig>; |
100type PartialConfig = DeepPartial<IConfig> | null; 101type IConfigPathsObj = KeyPathsObj<DeepPartial<IConfig>, IConfigPaths>; 102 103let config: PartialConfig = null; 104/** 初始化config */ 105async function setup() { 106 config = (await getStorage('local-config')) ?? {}; 107 // await checkValidPath(['setting.theme.background']); --- 92 unchanged lines hidden --- | 108type PartialConfig = DeepPartial<IConfig> | null; 109type IConfigPathsObj = KeyPathsObj<DeepPartial<IConfig>, IConfigPaths>; 110 111let config: PartialConfig = null; 112/** 初始化config */ 113async function setup() { 114 config = (await getStorage('local-config')) ?? {}; 115 // await checkValidPath(['setting.theme.background']); --- 92 unchanged lines hidden --- |