How to clearInterval with unknown ID?

前端 未结 4 1779
眼角桃花
眼角桃花 2020-11-29 04:30

Say someone (evil) has set us a timer with setInterval, but we don\'t know its ID (we don\'t have the reference to the object, that setInterval is returning, no

4条回答
  •  孤独总比滥情好
    2020-11-29 05:16

    I solved it by using localstorage, saving there the id of the setInterval, and picking up it later in order to clear that interval..

提交回复
热议问题