TreeINFO-For-M365 documentation
    Preparing search index...
    RunWithLoaderType: <T>(action: () => Promise<T>, loaderText?: string) => Promise<T>

    Function to run an async action with a loading indicator. The loader will be displayed until the action is completed.

    Type declaration

      • <T>(action: () => Promise<T>, loaderText?: string): Promise<T>
      • Type Parameters

        • T

          The return type of the async action

        Parameters

        • action: () => Promise<T>

          The async action to run

        • OptionalloaderText: string

          Optional text to display with the loader

        Returns Promise<T>

        A promise that resolves to the result of the async action

    tisa.utils.runWithLoader(async () => {
    console.log("Main operation started...");

    // simulation of asynchronous operation
    await new Promise(resolve => setTimeout(resolve, 2000));

    await tisa.utils.runWithLoader(async () => {
    console.log("Sub-operation started...");

    // simulation of asynchronous operation
    await new Promise(resolve => setTimeout(resolve, 3000));

    console.log("Sub-operation completed.");

    }, "Processing sub-task...");

    // simulation of asynchronous operation
    await new Promise(resolve => setTimeout(resolve, 2000));

    console.log("Main operation completed.");
    }, "Processing main task...");