Table of Contents

Class TaskSignal

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

The TaskSignal interface of the Prioritized Task Scheduling API represents a signal object that allows you to communicate with a prioritized task, and abort it or change the priority (if required) via a 'TaskController' object.

[Value("TaskSignal")]
public class TaskSignal : AbortSignal
Inheritance
TaskSignal
Inherited Members

Remarks

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(TaskControllerInit) constructor (by default it is "user-visible").
The priority can be changed by calling SetPriority(TaskPriority) on the controller.

The signal may be passed as the options.signal argument in PostTask(SchedulerPostTaskCallback, SchedulerPostTaskOptions), after which it's associated controller can be used to abort the task.
If the task priority is mutable, 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.

See also on MDN

Constructors

TaskSignal()

public TaskSignal()

Properties

Onprioritychange

[Value("onprioritychange")]
public EventHandlerNonNull Onprioritychange { get; set; }

Property Value

EventHandlerNonNull

Priority

The read-only priority property of the TaskSignal interface indicates the signal priority.

[Value("priority")]
public TaskPriority Priority { get; }

Property Value

TaskPriority

A string indicating the signal priority.
This will be one of: "user-blocking", "user-visible", "background".

Remarks

The initial value is set in the associated TaskController by specifying it as an argument to the TaskController constructor (by default it is "user-visible").
The priority of the signal can be changed by calling SetPriority(TaskPriority) on the associated controller.

For tasks with a mutable priority, this value is used to set the initial task priority and later to change it.
Tasks with an immutable priority will ignore the value.

See also on MDN

Methods

Any(List<AbortSignal>, TaskSignalAnyInit)

The TaskSignal.any() static method takes an iterable of AbortSignal objects and returns a TaskSignal. The returned task signal is aborted when any of the abort signals is aborted.

[Value("any")]
public static TaskSignal Any(List<AbortSignal> signals, TaskSignalAnyInit init = null)

Parameters

signals List<AbortSignal>
init TaskSignalAnyInit

Returns

TaskSignal

A TaskSignal instance. It will be aborted when the first signal passed into signals is aborted. When this happens:

Remarks

When the task signal is aborted, its Reason property will be set to the reason of the first signal that is aborted.

-AbortSignalany

See also on MDN