MCPcopy Index your code
hub / github.com/ionic-team/ionic-framework / useIonLoading

Function useIonLoading

packages/react/src/hooks/useIonLoading.tsx:13–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11 * @returns Returns the present and dismiss methods in an array
12 */
13export function useIonLoading(): UseIonLoadingResult {
14 const controller = useController<LoadingOptions, HTMLIonLoadingElement>(
15 'IonLoading',
16 loadingController,
17 defineCustomElement
18 );
19
20 const present = useCallback(
21 (
22 messageOrOptions: string | (LoadingOptions & HookOverlayOptions) = {},
23 duration?: number,
24 spinner?: SpinnerTypes
25 ) => {
26 if (typeof messageOrOptions === 'string') {
27 return controller.present({
28 message: messageOrOptions,
29 duration,
30 spinner,
31 });
32 } else {
33 return controller.present(messageOrOptions);
34 }
35 },
36 [controller.present]
37 );
38
39 return [present, controller.dismiss];
40}
41
42export type UseIonLoadingResult = [
43 {

Callers 1

LoadingHookFunction · 0.90

Calls 2

useControllerFunction · 0.90
presentMethod · 0.65

Tested by

no test coverage detected