avoid text overlapping
This commit is contained in:
+18
-2
@@ -94,12 +94,28 @@ const Utils = {
|
||||
})
|
||||
},
|
||||
|
||||
async wait(ms){
|
||||
async wait(ms, opts = {}){
|
||||
await new Promise((resolve, reject)=>{
|
||||
setTimeout(resolve, ms)
|
||||
opts.id = setTimeout(resolve, ms)
|
||||
opts.resolve = resolve;
|
||||
opts.reject = reject;
|
||||
})
|
||||
},
|
||||
|
||||
async killWait(opts){
|
||||
if (opts.id){
|
||||
clearTimeout(opts.id);
|
||||
if (opts.onKill == 'resolve') {
|
||||
await opts.resolve()
|
||||
}else {
|
||||
await opts.reject()
|
||||
}
|
||||
delete opts.id;
|
||||
delete opts.resolve;
|
||||
delete opts.reject;
|
||||
}
|
||||
},
|
||||
|
||||
async waitFor(expFn){
|
||||
while (!expFn()){
|
||||
await Utils.wait(200);
|
||||
|
||||
Reference in New Issue
Block a user