import type { IResettableModel, IValueModel } from './types.js'; export type LoadingWorker = () => (T | Promise); export type LoadingResult = { aborted: true; } | { aborted: false; result: T; }; export declare function withLoading(this: void, model: IValueModel, cb: LoadingWorker, exclusive?: boolean | 'throw'): Promise>; export declare class LoadingModel implements IValueModel, IResettableModel { protected readonly _number: IValueModel & IResettableModel; protected _firstInit: boolean; /** * @param useFirstInit - if true, then `isLoading` will be returning 'true' until first `useLoading` call. Defaults to false. */ constructor(useFirstInit?: boolean); get isLoading(): boolean; get value(): boolean; set value(v: boolean); useLoading(cb: LoadingWorker, exclusive?: boolean | 'throw'): Promise>; reset(): void; setValue(isLoading: boolean): void; /** override me */ protected incrementLoading(): void; /** override me */ protected decrementLoading(): void; /** override me * * Called in the ctor. Should be pure and should NOT access `this`. */ protected pureConstructNumberModel(): IValueModel & IResettableModel; } export declare class ExclusiveLoadingError extends Error { readonly actionName?: string | undefined; constructor(message?: string, actionName?: string | undefined); }