Files
zyt/TUICallKit-Vue3/TUIKit/states/chat-uikit-engine-lite/TUIStore/store/custom.ts
T
2026-03-11 09:49:47 +08:00

28 lines
534 B
TypeScript

import type { ICustomStore } from '../../interface/store';
export default class CustomStore implements ICustomStore {
public store: any;
constructor() {
this.store = {};
}
update(key: string, data: any) {
this.store[key] = data;
}
getData(key: string) {
return this.store[key];
}
reset(keyList: string[] = []) {
if (keyList.length === 0) {
this.store = {};
}
this.store = {
...this.store,
...keyList.reduce((acc, key) => ({ ...acc, [key]: undefined }), {}),
};
}
}