mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-03-12 23:20:25 +08:00
fixed color getting not working when updated are needed
This commit is contained in:
parent
3d2baf0d8f
commit
4fd39fa8a4
1 changed files with 15 additions and 13 deletions
|
@ -31,27 +31,29 @@ export async function get(color) {
|
|||
|
||||
return check();
|
||||
|
||||
function run() {
|
||||
setTimeout(() => {
|
||||
update();
|
||||
if (color === undefined) {
|
||||
ret = colors;
|
||||
} else {
|
||||
ret = colors[color];
|
||||
}
|
||||
return check();
|
||||
}, 500);
|
||||
async function run() {
|
||||
return new Promise(function (resolve, reject) {
|
||||
window.setTimeout(() => {
|
||||
update();
|
||||
if (color === undefined) {
|
||||
ret = colors;
|
||||
} else {
|
||||
ret = colors[color];
|
||||
}
|
||||
resolve(check());
|
||||
}, 500);
|
||||
});
|
||||
}
|
||||
function check() {
|
||||
async function check() {
|
||||
if (color === undefined) {
|
||||
if (ret.bg === "") {
|
||||
run();
|
||||
return await run();
|
||||
} else {
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
if (ret === "") {
|
||||
run();
|
||||
return await run();
|
||||
} else {
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue