@frui.ts/helpers
Version:
Frui.ts helper functions
19 lines (18 loc) • 795 B
TypeScript
import { ObservableMap } from "mobx";
export type BusyWatcherKey = string | symbol;
export interface IBusyWatcher {
readonly isBusy: boolean;
checkBusy(key: BusyWatcherKey): boolean;
}
export default class BusyWatcher implements IBusyWatcher {
protected busyCounter: ObservableMap<BusyWatcherKey, number>;
constructor();
get isBusy(): boolean;
checkBusy(key: BusyWatcherKey): boolean;
getBusyTicket(key?: BusyWatcherKey): () => void;
watch<T>(watchedAction: Promise<T>): Promise<T>;
}
type Decorator = (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
export declare function watchBusy(key: BusyWatcherKey): Decorator;
export declare function watchBusy(target: any, propertyKey: string, descriptor: PropertyDescriptor): void;
export {};