Skip to content

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

ParameterTypeDescription
ctxContextThe context to render to.
jobsTArray of jobs to execute.
options?RunJobsWithProgressListOptionsConfiguration 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,
});

Matterway Assistant SDK Documentation