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: packages/sdk/src/renderer/templates/runJobsWithProgressList.ts:83
Runs jobs while displaying a real-time progress list, where each row flips from in-progress to done/failed as its job settles. Resolves with 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 () => fetchData()},
{title: 'Processing data', handler: async () => process()},
], {
title: 'Processing Data',
concurrency: 1,
});