Appearance
Function: runJobsWithProgressList()
ts
function runJobsWithProgressList<T>(
ctx: Context,
jobs: T,
options?: RunJobsWithProgressListOptions): Promise<Awaited<{ [K in string | number | symbol]: JobResult<HandlerResult<T[K]>> }>>;Defined in: src/renderer/templates/runJobsWithProgressList.ts:128
Runs jobs while displaying a real-time progress list.
Shows a bubble with progress items that update as jobs execute. Resolves when all jobs complete. Returns the job results.
Type Parameters
| Type Parameter |
|---|
T extends JobList |
Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | Context | The context to render to. |
jobs | T | Array of jobs to execute. |
options? | RunJobsWithProgressListOptions | Configuration for the bubble and job execution options. |
Returns
Promise<Awaited<{ [K in string | number | symbol]: JobResult<HandlerResult<T[K]>> }>>
The job results.
Example
ts
import {runJobsWithProgressList} from '@matterway/sdk/UI';
const results = await runJobsWithProgressList(ctx, [
{
title: 'Fetching data',
handler: async () => {
await wait(1000);
return 'data fetched';
},
},
{
title: 'Processing data',
handler: async () => {
await wait(2000);
return 'data processed';
},
},
], {
title: 'Processing Data',
description: 'Please wait while we process your data',
concurrency: 1,
});