prefer-storage
Version:
1. key: 键名不唯一 2. value: 只能存储string类型 3. time: 没有过期时间 4. handle data: 不能对数据统一处理
38 lines (37 loc) • 987 B
TypeScript
import { type IProjectOption } from '@/types/index';
export default class Project<T> {
name: string;
keys: T[];
expire: number;
idbVersion: number;
idbStoreOption: IDBObjectStoreParameters;
idCreateIndexs: string[];
beforeGet?: (val: {
v: any;
_isDue: boolean;
_key: string;
_pathname: string;
}) => Promise<any>;
afterGet?: (key: string) => Promise<any>;
beforeSet?: (val: {
value: any;
type: string;
time: string;
key: string;
pathname: string;
}) => Promise<any>;
afterSet?: (res: any) => Promise<any>;
idBeforeGet?: (val: {
v: any;
_isDue: boolean;
_pathname: string;
}) => Promise<any>;
idBeforeSet?: (val: {
value: any;
time: string;
pathname: string;
}) => Promise<any>;
idAfterSet?: (res: any) => Promise<any>;
options: Recordable<string>;
constructor(options: IProjectOption<T>);
}