fixed color getting not working when updated are needed

This commit is contained in:
Jack 2021-08-07 15:44:44 +01:00
parent 3d2baf0d8f
commit 4fd39fa8a4

View file

@ -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;
}