1 | import { Resolver } from '@shopify/async';
|
2 | import { IfAllOptionalKeys } from '@shopify/useful-types';
|
3 | import { AssetTiming, AsyncComponentType } from './types';
|
4 | export declare function usePreload<PreloadOptions extends object>(...args: IfAllOptionalKeys<PreloadOptions, [AsyncComponentType<any, any, PreloadOptions, any, any>, PreloadOptions?], [AsyncComponentType<any, any, PreloadOptions, any, any>, PreloadOptions]>): ReturnType<typeof args[0]['usePreload']>;
|
5 | export declare function usePrefetch<PrefetchOptions extends object>(...args: IfAllOptionalKeys<PrefetchOptions, [AsyncComponentType<any, any, any, PrefetchOptions, any>, PrefetchOptions?], [AsyncComponentType<any, any, any, PrefetchOptions, any>, PrefetchOptions]>): ReturnType<typeof args[0]['usePrefetch']>;
|
6 | export declare function useKeepFresh<KeepFreshOptions extends object>(...args: IfAllOptionalKeys<KeepFreshOptions, [AsyncComponentType<any, any, any, any, KeepFreshOptions>, KeepFreshOptions?], [AsyncComponentType<any, any, any, any, KeepFreshOptions>, KeepFreshOptions]>): ReturnType<typeof args[0]['useKeepFresh']>;
|
7 | interface Options {
|
8 | immediate?: boolean;
|
9 | assets?: AssetTiming;
|
10 | styles?: AssetTiming;
|
11 | scripts?: AssetTiming;
|
12 | }
|
13 | export declare function useAsync<T>(resolver: Resolver<T>, { assets, scripts, styles, immediate }?: Options): {
|
14 | id: string | undefined;
|
15 | resolved: null;
|
16 | error: Error;
|
17 | loading: boolean;
|
18 | load: () => Promise<Error | T>;
|
19 | } | {
|
20 | id: string | undefined;
|
21 | resolved: T | null;
|
22 | error: null;
|
23 | loading: boolean;
|
24 | load: () => Promise<Error | T>;
|
25 | };
|
26 | export declare function useAsyncAsset(id?: string, { scripts, styles }?: {
|
27 | styles?: AssetTiming;
|
28 | scripts?: AssetTiming;
|
29 | }): void;
|
30 | export {};
|