clearTimeout without ID

后端 未结 4 1039
日久生厌
日久生厌 2021-01-14 02:16

Is there any way to clear setTimeout() if it doesn\'t have an explicit ID? The problem is I\'m not allowed to change some code that already ran and set the tim

4条回答
  •  生来不讨喜
    2021-01-14 02:27

    No. But you could make the handler check whether it should still handle the event (with a boolean variable).

提交回复
热议问题