refactor: tweak profile loader
This commit is contained in:
@ -10,8 +10,9 @@ export interface KeyedHookFilter {
|
||||
fn: HookFn;
|
||||
}
|
||||
|
||||
export interface CacheEvents {
|
||||
export interface CacheEvents<T> {
|
||||
change: (keys: Array<string>) => void;
|
||||
update: (v: T) => void;
|
||||
}
|
||||
|
||||
export type CachedTable<T> = {
|
||||
@ -41,12 +42,12 @@ export type CachedTable<T> = {
|
||||
key(of: T): string;
|
||||
snapshot(): Array<T>;
|
||||
search(q: string): Promise<Array<T>>;
|
||||
} & EventEmitter<CacheEvents>;
|
||||
} & EventEmitter<CacheEvents<T>>;
|
||||
|
||||
/**
|
||||
* Dexie backed generic hookable store
|
||||
*/
|
||||
export abstract class FeedCache<TCached> extends EventEmitter<CacheEvents> implements CachedTable<TCached> {
|
||||
export abstract class FeedCache<TCached> extends EventEmitter<CacheEvents<TCached>> implements CachedTable<TCached> {
|
||||
readonly name: string;
|
||||
#snapshot: Array<TCached> = [];
|
||||
protected log: ReturnType<typeof debug>;
|
||||
|
Reference in New Issue
Block a user