File tree Expand file tree Collapse file tree
src/domains/attempt/compositions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ const ELAPSED_BEFORE_BEING_FINAL_MS = 1000;
2121function useAttemptManagerFactory ( ) {
2222 let state : State = "WAITING_ATTEMPT" ;
2323 let attempt = createAttemptHandler ( "Search for..." , "?" ) ;
24- const { isFinalTime } = useIsFinalTime ( ELAPSED_BEFORE_BEING_FINAL_MS ) ;
24+ const { deferFinalTime , isFinalTime } = useIsFinalTime ( ELAPSED_BEFORE_BEING_FINAL_MS ) ;
2525
2626 /**
2727 * Returns an AttemptEntity object only if there was a creation or an update of an AttemptEntity
@@ -35,6 +35,7 @@ function useAttemptManagerFactory() {
3535 const coins = Coins . get ( image , putImageData ) ;
3636
3737 if ( ! isDefined ( time ) || ! isDefined ( coins ) ) {
38+ deferFinalTime ( ) ;
3839 return undefined ;
3940 }
4041
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ function useIsFinalTimeFactory(beforeFinalMs: number) {
99 const now = Date . now ( ) ;
1010
1111 if ( isPause ) {
12- lastTimestamp = now ;
12+ deferFinalTime ( now ) ;
1313 return false ;
1414 }
1515
@@ -32,8 +32,13 @@ function useIsFinalTimeFactory(beforeFinalMs: number) {
3232 return false ;
3333 } ;
3434
35+ const deferFinalTime = ( time ?: number ) : void => {
36+ lastTimestamp = time ?? Date . now ( ) ;
37+ } ;
38+
3539 return {
3640 isFinalTime,
41+ deferFinalTime,
3742 } ;
3843}
3944
You can’t perform that action at this time.
0 commit comments