chore: init project

This commit is contained in:
vben
2024-05-19 21:20:42 +08:00
commit 399334ac57
630 changed files with 45623 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
import type { DeepPartial, Preference } from '@vben-core/typings';
import { PreferenceCache } from './cache';
import { overridesPreference } from './preference';
interface SetupPreferenceOptions {
/**
* @zh_CN 应用名,由于 @vben/preference 是公用的后续可能有多个app为了防止多个app缓存冲突可在这里配置应用名
* 应用名将被用于持久化的前缀
*/
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 };