e01.org

TaskSignal

Prioritized Task Scheduling API

Prioritized Task Scheduling API

The **`TaskSignal`** interface of the [Prioritized Task Scheduling API](/docs/Web/API/Prioritized_Task_Scheduling_API) represents a signal object that allows you to communicate with a prioritized task, and abort it or change the [priority](/docs/Web/API/Prioritized_Task_Scheduling_API#task_priorities) (if required) via a TaskController object.

An object of this type is created, and associated with, a TaskController.
The initial priority of the signal may be set by specifying it as an argument to the TaskController() constructor (by default it is `"user-visible"`).
The priority can be changed by calling TaskController.setPriority() on the controller.

The signal may be passed as the `options.signal` argument in Scheduler.postTask(), after which its associated controller can be used to abort the task.
If the [task priority is mutable](/docs/Web/API/Prioritized_Task_Scheduling_API#mutable_and_immutable_task_priority), the controller can also be used to change the task's priority.
Abortable tasks that do not need the priority to change may instead specify an AbortSignal as the `options.signal` argument.

## Instance properties

_The `TaskSignal` interface also inherits properties from its parent interface, AbortSignal._

- TaskSignal.priority
- : Returns the priority of the signal.

## Static methods

_The `TaskSignal` interface inherits methods from its parent interface, AbortSignal._

- TaskSignal.any()
- : Returns a **`TaskSignal`** that aborts when any of the given abort signals abort.

## Instance methods

_The `TaskSignal` interface inherits methods from its parent interface, AbortSignal._

## Events

Listen to these events using addEventListener() or by assigning an event listener to the `oneventname` property of this interface.

- prioritychange
- : Fired when the priority is changed.
This is triggered by calling TaskController.setPriority() on the associated controller.

## Examples

Examples for how the `TaskSignal` is created and used for prioritizing and aborting tasks can be found here:

- [Prioritized Task Scheduling API > Examples](/docs/Web/API/Prioritized_Task_Scheduling_API#examples)
- [`TaskController` > Examples](/docs/Web/API/TaskController#examples)
- [`TaskSignal: prioritychange` event > Examples](/docs/Web/API/TaskSignal/prioritychange_event#examples)

## Specifications

## Browser compatibility

source: MDN Web Docs mirror · page

Cite this

"TaskSignal". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/API/TaskSignal

JSON record · API collection · citation policy