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

Function examPauseLock

tech-study.js:3057–3091  ·  view source on GitHub ↗

* @description 暂停锁

(callback)

Source from the content-addressed store, hash-verified

3055 * @description 暂停锁
3056 */
3057function examPauseLock(callback) {
3058 return new Promise((resolve) => {
3059 // 学习暂停
3060 const pauseStudy = (GM_getValue('pauseStudy') || false);
3061 // 全局暂停
3062 if (pauseStudy) {
3063 examPause.value = true;
3064 }
3065 // 暂停
3066 if (examPause.value) {
3067 // 创建提示
3068 createTip('已暂停, 手动开启自动答题! ', 10);
3069 const doing = setInterval(() => {
3070 if (!examPause.value) {
3071 // 停止定时器
3072 clearInterval(doing);
3073 log('答题等待结束!');
3074 if (callback && callback instanceof Function) {
3075 // 创建提示
3076 createTip('已开启, 自动答题!');
3077 callback(true);
3078 }
3079 resolve(true);
3080 return;
3081 }
3082 if (callback && callback instanceof Function) {
3083 callback(false);
3084 }
3085 log('答题等待...');
3086 }, 500);
3087 return;
3088 }
3089 resolve(true);
3090 });
3091}
3092/**
3093 * @description 答题
3094 */

Callers 1

doingExamFunction · 0.70

Calls 2

createTipFunction · 0.70
logFunction · 0.70

Tested by

no test coverage detected