diff options
| author | Hsieh Chin Fan <pham@topo.tw> | 2024-10-02 21:30:25 +0800 |
|---|---|---|
| committer | Hsieh Chin Fan <pham@topo.tw> | 2024-10-02 21:30:25 +0800 |
| commit | 2c265941b5312f23d1f798bdc06ecee2c001db4f (patch) | |
| tree | 92bd5c0bae9380606e150b06452640e4c8f53a0b /src | |
| parent | 1bb21622b8c25da5032850f21eac12dae5a61527 (diff) | |
feat: prevent render indicator appears agein
Diffstat (limited to 'src')
| -rw-r--r-- | src/dumbymap.mjs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/dumbymap.mjs b/src/dumbymap.mjs index 2ea5b0c..f85251a 100644 --- a/src/dumbymap.mjs +++ b/src/dumbymap.mjs | |||
| @@ -387,15 +387,17 @@ export const generateMaps = (container, { delay, mapCallback }) => { | |||
| 387 | ).length | 387 | ).length |
| 388 | const total = steps.length | 388 | const total = steps.length |
| 389 | passNum += `/${total}` | 389 | passNum += `/${total}` |
| 390 | if (results.filter(r => r.type === 'render').length === total) { | 390 | |
| 391 | passNum += '\u0020' | 391 | const final = results.filter(r => r.type === 'render').length === total |
| 392 | } | ||
| 393 | 392 | ||
| 394 | // FIXME HACK use MutationObserver for animation | 393 | // FIXME HACK use MutationObserver for animation |
| 395 | if (!target.animations) target.animations = Promise.resolve() | 394 | if (!target.animations) target.animations = Promise.resolve() |
| 396 | target.animations = target.animations.then(async () => { | 395 | target.animations = target.animations.then(async () => { |
| 397 | await new Promise(resolve => setTimeout(resolve, 100)) | 396 | await new Promise(resolve => setTimeout(resolve, 100)) |
| 397 | if (final) passNum += '\x20' | ||
| 398 | target.setAttribute('data-report', passNum) | 398 | target.setAttribute('data-report', passNum) |
| 399 | |||
| 400 | if (final) setTimeout(() => target.removeAttribute('data-report'), 100) | ||
| 399 | }) | 401 | }) |
| 400 | } | 402 | } |
| 401 | /** | 403 | /** |