import { Unit, Options, Widget, Fun, Action, IOWidget } from '../shared/widget';
export declare type HttpResult = ({
kind: "result";
value: a;
} | {
kind: "unauthorized";
} | {
kind: "failed";
}) & {
status: number;
};
export declare type LoadedAsyncState = {
kind: "loaded";
value: a;
};
export declare type LoadingAsyncState = {
kind: "loading";
value?: a;
};
export declare type AsyncState = LoadedAsyncState | {
kind: "unloaded";
} | ((LoadingAsyncState | {
kind: "connection-error";
} | {
kind: "unauthorized";
status: number;
} | {
kind: "failed";
status: number;
}) & {
p: Fun>>;
});
export interface AsyncOptions extends Options {
loading?: IOWidget, never>;
connectionError?: Widget;
unauthorizedError?: Widget>>;
otherError?: Widget>>;
unloaded?: Widget>>;
}
export declare let async: (w: IOWidget>>, options?: AsyncOptions | undefined) => (s0: AsyncState) => Widget>>;
export declare let unloadedAsyncState: () => AsyncState;
export declare let unauthorizedAsyncState: (status: number) => AsyncState;
export declare let errorAsyncState: (status: number) => AsyncState;
export declare let loadedAsyncState: (v: a) => AsyncState;
export declare let loadingAsyncState: (p: Fun>>, old_value?: a | undefined) => AsyncState;