Table of Contents

Class TaskController

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

The TaskController interface of the Prioritized Task Scheduling API represents a controller object that can be used to both abort and change the priority of one or more prioritized tasks.
If there is no need to change task priorities, then AbortController can be used instead.

[Value("TaskController")]
public class TaskController : AbortController
Inheritance
TaskController
Inherited Members

Remarks

A new TaskController instance is created using the TaskController(TaskControllerInit) constructor, optionally specifying a priority for its associated signal (a TaskSignal).
If not specified, the signal will have a priority of "user-visible" by default.

The controller's signal can be passed as an argument to the PostTask(SchedulerPostTaskCallback, SchedulerPostTaskOptions) method for one or more tasks.
For mutable tasks (only) the task is initialized with the signal priority, and can later be changed by calling 'TaskController.SetPriority'.
For immutable tasks, any priority initialized or set by the controller is ignored.

Tasks can be aborted by calling Abort(dynamic) on the controller.

See also on MDN

Constructors

TaskController()

public TaskController()

TaskController(TaskControllerInit)

The TaskController() constructor creates a new TaskController object, optionally setting the initial priority of its associated signal.

public TaskController(TaskControllerInit init = null)

Parameters

init TaskControllerInit

Remarks

If no priority is set, the signal priority defaults to user-visible

See also on MDN

Methods

SetPriority(TaskPriority)

The setPriority() method of the TaskController interface can be called to set a new priority for this controller's signal.
If a prioritized task is configured to use the signal, this will also change the task priority.

[Value("setPriority")]
public GlobalObject.Undefined SetPriority(TaskPriority priority)

Parameters

priority TaskPriority

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

Observers are notified of priority changes by dispatching a prioritychange event.
The method will only notify if the priority actually changes (the event is not fired if the priority would not be changed by the call).

Note that task priority can only be changed for tasks with mutable priorities.
If the task is immutable, the function call is ignored.

See also on MDN