WorkerGlobalScope:clearInterval() 方法
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
备注: 此特性仅在 Web Worker 中可用。
WorkerGlobalScope
接口的 clearInterval()
方法可取消先前通过调用 setInterval()
设置的重复定时任务。如果提供的参数未指定先前建立的操作,则此方法不执行任何动作。
语法
js
clearInterval(intervalID)
参数
intervalID
-
你要取消的重复操作的标识符。这个 ID 是由对应的
setInterval()
调用返回的。
值得一提的是,setInterval()
和 setTimeout()
共享同一个 ID 池,并且 clearInterval()
和 clearTimeout()
在技术上是可互换使用的。然而,为了清晰起见,你应该尽量避免这种用法。
返回值
无(undefined
)。
示例
参见 setInterval()
以获取示例。
规范
Specification |
---|
HTML # dom-clearinterval-dev |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
clearInterval | ||||||||||||||
Available in workers |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- Partial support
- Partial support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.