此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

window.cancelIdleCallback()

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

window.cancelIdleCallback() 方法用于取消之前调用window.requestIdleCallback() 的回调。

语法

js
cancelIdleCallback(handle)

参数

handle

调用 window.requestIdleCallback() 时返回的 ID.

返回值

无(undefined)。

示例

在文章 Cooperative Scheduling of Background Tasks API 中可以查看 完整示例

规范

Specification
requestIdleCallback()
# the-cancelidlecallback-method

浏览器兼容性