Spaces:
Running
Running
| // Simulate typing effect by revealing text one character at a time | |
| export function simulateTyping(fullText, onUpdate, onComplete, delay = 20) { | |
| let index = 0; | |
| const interval = setInterval(() => { | |
| onUpdate((prev) => prev + fullText[index]); | |
| index++; | |
| if (index >= fullText.length) { | |
| clearInterval(interval); | |
| onComplete(); | |
| } | |
| }, delay); | |
| } | |