()
| 271 | } |
| 272 | |
| 273 | const run = () => { |
| 274 | timeout = undefined |
| 275 | const text = getValue() |
| 276 | if (!live?.()) { |
| 277 | sync(text) |
| 278 | return |
| 279 | } |
| 280 | if (!text.startsWith(shown) || text.length <= shown.length) { |
| 281 | sync(text) |
| 282 | return |
| 283 | } |
| 284 | if (text.length - shown.length <= TEXT_RENDER_IMMEDIATE) { |
| 285 | sync(text) |
| 286 | return |
| 287 | } |
| 288 | const end = next(text, shown.length) |
| 289 | sync(text.slice(0, end)) |
| 290 | if (end < text.length) timeout = setTimeout(run, TEXT_RENDER_PACE_MS) |
| 291 | } |
| 292 | |
| 293 | createEffect(() => { |
| 294 | const text = getValue() |