首页 > 其他分享 >每五秒获取调取告警接口

每五秒获取调取告警接口

时间:2022-08-14 18:02:08浏览次数:47  
标签:res 五秒 getAlarm time 告警 clearTimeout 调取

  // 告警数量   const getAlarm = () => {     getAlarmCount().then(       (res: any) => {         if (res.code == 200) {           setCount(res.data)           clearTimeout(time)           time = setTimeout(() => {             getAlarm()           }, 5000);         }       }     )
  }   useEffect(() => {     getAlarm()     return () => {       clearTimeout(time)     }   }, [])

标签:res,五秒,getAlarm,time,告警,clearTimeout,调取
From: https://www.cnblogs.com/yzy521/p/16585921.html

相关文章