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