TaskController extension type
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.
A new TaskController
instance is created using the
TaskController.TaskController
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 Scheduler.postTask 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 AbortController.abort on the controller.
API documentation sourced from MDN Web Docs.
- on
- Implemented types
- Available extensions
Constructors
- TaskController([TaskControllerInit init])
-
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- signal → AbortSignal
-
The
signal
read-only property of the AbortController interface returns an AbortSignal object instance, which can be used to communicate with/abort an asynchronous operation as desired.no setterinherited
Methods
-
abort(
[JSAny? reason]) → void -
The
abort()
method of the AbortController interface aborts an asynchronous operation before it has completed. This is able to abort fetch requests, the consumption of any response bodies, or streams.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setPriority(
TaskPriority priority) → void -
The
setPriority()
method of the TaskController interface can be called to set a new priority for this controller'ssignal
. If a prioritized task is configured to use the signal, this will also change the task priority. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited