run actions only in the right state
This commit is contained in:
		
							parent
							
								
									310a680f6b
								
							
						
					
					
						commit
						332c33480c
					
				| @ -56,17 +56,25 @@ export class BenchmarkSuite { | ||||
|   } | ||||
| 
 | ||||
|   start() { | ||||
|     this.state = 'running' | ||||
|     this.run() | ||||
|     if (this.state === 'initialized' || this.state === 'paused') { | ||||
|       this.state = 'running' | ||||
|       this.run() | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   pause() { | ||||
|     this.state = 'pause_requested' | ||||
|     if (this.state === 'running') this.state = 'pause_requested' | ||||
|   } | ||||
| 
 | ||||
|   stop() { | ||||
|     this.state = 'stop_requested' | ||||
|     this.run() | ||||
|     if ( | ||||
|       this.state === 'running' || | ||||
|       this.state === 'paused' || | ||||
|       this.state === 'finished' | ||||
|     ) { | ||||
|       this.state = 'stop_requested' | ||||
|       this.run() | ||||
|     } | ||||
|   } | ||||
| } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user