mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-30 00:00:13 +01:00
periodically refresh simulator states
This commit is contained in:
parent
9efdd2f111
commit
dd1c5ddf01
1 changed files with 14 additions and 0 deletions
|
@ -89,6 +89,20 @@ class Simulators extends Component {
|
|||
type: 'simulators/start-load',
|
||||
token: this.state.sessionToken
|
||||
});
|
||||
|
||||
// Start timer for periodic refresh
|
||||
this.timer = window.setInterval(() => this.refresh(), 1000);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
window.clearInterval(this.timer);
|
||||
}
|
||||
|
||||
refresh() {
|
||||
AppDispatcher.dispatch({
|
||||
type: 'simulators/start-load',
|
||||
token: this.state.sessionToken
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue