MCPcopy Create free account
hub / github.com/Xu22Web/tech-study-js / refreshScheduleTask

Function refreshScheduleTask

tech-study.js:4295–4328  ·  view source on GitHub ↗

* @description 刷新定时任务

()

Source from the content-addressed store, hash-verified

4293 * @description 刷新定时任务
4294 */
4295async function refreshScheduleTask() {
4296 // 清除定时刷新
4297 clearInterval(scheduleTimer);
4298 // 未登录
4299 if (!login.value) {
4300 // 剩余定时任务
4301 const restList = scheduleList.filter((s) => !isLate(s));
4302 // 存在剩余任务
4303 if (restList.length) {
4304 const rest = restList[0];
4305 log(`已设置 ${rest.time} 的定时任务!`);
4306 // 提示
4307 createTip(`已设置 ${rest.time} 的定时任务!`);
4308 // 时间
4309 let time = 0;
4310 // 刷新间隔
4311 const interval = 10;
4312 scheduleTimer = setInterval(() => {
4313 if (!(time++ % interval)) {
4314 log('定时刷新正在运行...');
4315 }
4316 // 到达定时
4317 if (isNow(rest)) {
4318 clearInterval(scheduleTimer);
4319 log(`执行 ${rest.time} 的定时任务!`);
4320 // 提示
4321 createTip(`执行 ${rest.time} 的定时任务!`);
4322 // 登录
4323 handleLogin();
4324 }
4325 }, 1000);
4326 }
4327 }
4328}
4329/**
4330 * @description 清除定时
4331 */

Callers 3

ScheduleListFunction · 0.70
SettingsPanelFunction · 0.70
onMountedFunction · 0.70

Calls 5

isLateFunction · 0.70
logFunction · 0.70
createTipFunction · 0.70
isNowFunction · 0.70
handleLoginFunction · 0.70

Tested by

no test coverage detected