大网数据广告活动
Web 标准与前端开发

TaskController: TaskController() constructor

· 52CE 我爱测

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

Prioritized Task Scheduling API

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

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

Syntax

new TaskController()
new TaskController(options)

Parameters

  • options
    • : An object with the following properties:
      • priority
        • : The priority of the signal associated with this TaskController. One of: "user-blocking", "user-visible" (default), "background".

Examples

This code shows how to construct a task controller that has a signal with default priority (user-visible).

const controller = new TaskController();

To construct a task controller that has a specific signal priority, pass the priority as a property of the optional argument.

controller2 = new TaskController({ priority: "user-blocking" });

Specifications

Browser compatibility

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。