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

Function studyPauseLock

tech-study.js:2529–2556  ·  view source on GitHub ↗

* @description 暂停学习锁

(callback)

Source from the content-addressed store, hash-verified

2527 * @description 暂停学习锁
2528 */
2529function studyPauseLock(callback) {
2530 return new Promise((resolve) => {
2531 // 暂停
2532 const pauseStudy = GM_getValue('pauseStudy') || false;
2533 if (pauseStudy) {
2534 const doing = setInterval(() => {
2535 // 暂停
2536 const pauseStudy = GM_getValue('pauseStudy') || false;
2537 if (!pauseStudy) {
2538 // 停止定时器
2539 clearInterval(doing);
2540 log('学习等待结束!');
2541 if (callback && callback instanceof Function) {
2542 callback(true);
2543 }
2544 resolve(true);
2545 return;
2546 }
2547 if (callback && callback instanceof Function) {
2548 callback(false);
2549 }
2550 log('学习等待...');
2551 }, 500);
2552 return;
2553 }
2554 resolve(true);
2555 });
2556}
2557/**
2558 * @description 加载
2559 * @param match

Callers 5

doExamPracticeFunction · 0.70
readingFunction · 0.70
readNewsFunction · 0.70
watchVideoFunction · 0.70
studyFunction · 0.70

Calls 1

logFunction · 0.70

Tested by

no test coverage detected