File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ function layoutfluid(): void {
129129function checkIfFailed (
130130 wpmAndRaw : { wpm : number ; raw : number } ,
131131 acc : number
132- ) : void {
132+ ) : boolean {
133133 if ( timerDebug ) console . time ( "fail conditions" ) ;
134134 TestInput . pushKeypressesToHistory ( ) ;
135135 TestInput . pushErrorToHistory ( ) ;
@@ -143,16 +143,17 @@ function checkIfFailed(
143143 SlowTimer . clear ( ) ;
144144 slowTimerCount = 0 ;
145145 TimerEvent . dispatch ( "fail" , "min speed" ) ;
146- return ;
146+ return true ;
147147 }
148148 if ( Config . minAcc === "custom" && acc < Config . minAccCustom ) {
149149 if ( timer !== null ) clearTimeout ( timer ) ;
150150 SlowTimer . clear ( ) ;
151151 slowTimerCount = 0 ;
152152 TimerEvent . dispatch ( "fail" , "min accuracy" ) ;
153- return ;
153+ return true ;
154154 }
155155 if ( timerDebug ) console . timeEnd ( "fail conditions" ) ;
156+ return false ;
156157}
157158
158159function checkIfTimeIsUp ( ) : void {
@@ -200,8 +201,8 @@ async function timerStep(): Promise<void> {
200201 const acc = calculateAcc ( ) ;
201202 monkey ( wpmAndRaw ) ;
202203 layoutfluid ( ) ;
203- checkIfFailed ( wpmAndRaw , acc ) ;
204- checkIfTimeIsUp ( ) ;
204+ const failed = checkIfFailed ( wpmAndRaw , acc ) ;
205+ if ( ! failed ) checkIfTimeIsUp ( ) ;
205206 if ( timerDebug ) console . timeEnd ( "timer step -----------------------------" ) ;
206207}
207208
You can’t perform that action at this time.
0 commit comments