File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -86,16 +86,15 @@ const Main = ({
8686 do {
8787 setCurrentIndex ( - 1 ) ;
8888 const actions = getActions ( children , splitter ) ;
89- await timeoutPromise ( startDelay ) ;
89+ if ( startDelay > 0 ) await timeoutPromise ( startDelay ) ;
9090 for ( const { type, payload } of actions ) {
91+ if ( pause ) await pausePromise ( ) ;
9192 if ( type === 'TYPE_TOKEN' ) {
92- await pausePromise ( ) ;
9393 setCurrentIndex ( prev => prev + 1 ) ;
9494 await timeoutPromise ( typingDelay ) ;
9595 } else if ( type === 'BACKSPACE' ) {
9696 let amount = payload ;
9797 while ( amount -- ) {
98- await pausePromise ( ) ;
9998 setCurrentIndex ( prev => prev + 1 ) ;
10099 await timeoutPromise ( backspaceDelay ) ;
101100 }
@@ -106,8 +105,8 @@ const Main = ({
106105 }
107106 }
108107 onTypingDone ?.( ) ;
109- await timeoutPromise ( finishDelay ) ;
110- await loopPromise ( ) ;
108+ if ( finishDelay > 0 ) await timeoutPromise ( finishDelay ) ;
109+ if ( ! loopRef . current ) await loopPromise ( ) ;
111110 } while ( loopRef . current ) ;
112111 } catch ( error ) {
113112 // do nothing
You can’t perform that action at this time.
0 commit comments