Files
xk-admin/packages/preference/src/setup.ts

29 lines
832 B
TypeScript
Raw Normal View History

2024-05-19 21:20:42 +08:00
import type { DeepPartial, Preference } from '@vben-core/typings';
import { PreferenceCache } from './cache';
import { overridesPreference } from './preference';
interface SetupPreferenceOptions {
/**
* @zh_CN , @vben/preference appapp缓存冲突
*
*/
cachePrefix?: string;
/**
* @zh_CN app自行覆盖偏好设置
*/
overrides?: DeepPartial<Preference>;
}
async function setupPreference(options: SetupPreferenceOptions = {}) {
const { cachePrefix = 'vben-admin-pro', overrides = {} } = options;
const cache = new PreferenceCache(cachePrefix);
overridesPreference(overrides, cache);
}
export { setupPreference };
export type { SetupPreferenceOptions };