fix: wait for elapsed
This commit is contained in:
parent
fc96f637ff
commit
89044ab2cf
|
@ -48,10 +48,20 @@ export default class Script {
|
||||||
Math: MathUtil,
|
Math: MathUtil,
|
||||||
Promise: PromiseUtil,
|
Promise: PromiseUtil,
|
||||||
transition,
|
transition,
|
||||||
wait: (seconds) => (
|
wait: (seconds = 0) => (
|
||||||
new Promise((resolve) => {
|
new PromiseUtil.Ticker(
|
||||||
setTimeout(resolve, seconds * 1000);
|
(resolve) => {
|
||||||
})
|
if (0 === seconds) {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
(elapsed, resolve) => {
|
||||||
|
seconds -= elapsed;
|
||||||
|
if (seconds <= 0) {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user