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)。

示例

规范

Specification
requestIdleCallback() Cooperative Scheduling of Background Tasks
# the-cancelidlecallback-method

浏览器兼容性

BCD tables only load in the browser