choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
22 lines (21 loc) • 773 B
TypeScript
import { IReactionDisposer } from 'mobx';
import Cache from '../cache';
export default class PromiseMerger<K, ARGS, V> {
timeout: number;
cache: Cache<string, K>;
dataMap: Map<string, V>;
promiseMap: Map<string | symbol, Map<string, {
resolves: Function[];
rejects: Function[];
}>>;
waitID: any;
callback: (codes: string[], args: ARGS, dataList: V[]) => Promise<{
[key: string]: K;
}>;
reaction: IReactionDisposer;
constructor(callback: (codes: string[], args: ARGS, dataList: V[]) => Promise<{
[key: string]: K;
}>, config: any, timeout?: number);
dispose(): void;
add(code: string, getBatchKey: ((defaultKey: symbol) => string | symbol) | undefined, args: ARGS, data?: V): Promise<K>;
}