Skip to main content

Task

interface

A declared background task: a trigger the host evaluates durably, and a body that runs when it fires. Built with task and listed in `defineMod`'s `tasks` slot.

interface Task<TPayload = unknown>

Import

import { Task } from '@modular/sdk';

Members6

id
string

Identifier, unique within the mod.

kind
'task'
run
TaskHandler<TPayload>
titleoptional
string

Label shown where the host lists scheduled work.

trigger
TaskTriggerDto

The compiled trigger plan the host schedules.

whenoptional
(payload: TPayload) => boolean

Optional filter over the event payload, evaluated in the extension host before the body runs. A firing the filter declines does not consume the task's `once` slot.