run actions only in the right state

This commit is contained in:
Alfred Melch 2019-08-10 20:49:57 +02:00
parent a991649e90
commit 42a3671149

View File

@ -56,18 +56,26 @@ export class BenchmarkSuite {
}
start() {
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() {
if (
this.state === 'running' ||
this.state === 'paused' ||
this.state === 'finished'
) {
this.state = 'stop_requested'
this.run()
}
}
}
/**