Skip to main content

Interface: ITasksApi

Defined in: Extensions/ExtensionApiTypes.ts:705

Methods

cancel()

cancel(taskId): Promise<void>

Defined in: Extensions/ExtensionApiTypes.ts:721

Cancel a running task by ID.

Parameters

taskId

string

Returns

Promise<void>


isCancellationRequested()

isCancellationRequested(taskHandle): Promise<boolean>

Defined in: Extensions/ExtensionApiTypes.ts:718

True if the user has requested cancellation. The work handler should return early.

Parameters

taskHandle

string

Returns

Promise<boolean>


list()

list(): Promise<BackgroundTaskInfo[]>

Defined in: Extensions/ExtensionApiTypes.ts:724

List tasks owned by this extension.

Returns

Promise<BackgroundTaskInfo[]>


reportProgress()

reportProgress(taskHandle, update): Promise<void>

Defined in: Extensions/ExtensionApiTypes.ts:715

Report progress for a running task. Called from inside the work handler.

Parameters

taskHandle

string

update

TaskProgressUpdate

Returns

Promise<void>


run()

run<T>(task): Promise<T>

Defined in: Extensions/ExtensionApiTypes.ts:712

Run a long-running task. The host invokes workEndpoint via reverse-RPC with a taskHandle the worker uses to report progress and check for cancellation. The host shows a progress entry in the status bar and a notification on completion if notifyOnComplete is set.

Type Parameters

T

T = void

Parameters

task

BackgroundTaskDescriptor

Returns

Promise<T>