MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / typePhrase

Function typePhrase

web/src/components/IDEDemo.tsx:313–331  ·  view source on GitHub ↗
(phrase: string, callback: () => void)

Source from the content-addressed store, hash-verified

311 setIsTyping(true)
312
313 const typePhrase = (phrase: string, callback: () => void) => {
314 let index = 0
315
316 const typeNextChar = () => {
317 if (index < phrase.length) {
318 setTypingText(phrase.substring(0, index + 1))
319 index++
320
321 // Random typing speed between 50ms and 150ms for realistic effect
322 const typingSpeed = Math.floor(Math.random() * 100) + 50
323 setTimeout(typeNextChar, typingSpeed)
324 } else {
325 // Phrase is fully typed, wait before moving to next phrase
326 setTimeout(callback, 1500)
327 }
328 }
329
330 typeNextChar()
331 }
332
333 const startNextPhrase = () => {
334 const phrase = PHRASES_TO_TYPE[currentPhraseIndex]

Callers 1

startNextPhraseFunction · 0.85

Calls 1

typeNextCharFunction · 0.85

Tested by

no test coverage detected