For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt, and this page is available as Markdown at /next/zh/api/lynx-api/global/clear-timeout.md.
Lynx
  • 简体中文
  • clearTimeout() global function

    取消由 setTimeout 设置的定时器。

    语法

      clearTimeout(timerId: number): void;

    参数

    timerId

    setTimeout 返回的定时器 ID。如果该 ID 对应的定时器已经执行完毕,则该方法不会执行任何操作。

    传入一个非 setTimeout 返回的 ID 值是未定义行为,可能导致问题。

    示例

    注意事项

    1. setTimeout()setInterval() 共用一个编号池,因此技术上 clearTimeout()clearInterval() 可以互换。但是,为了避免混淆,不要混用取消定时函数。

    兼容性

    LCD tables only load in the browser

    除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。