Browse Source

ref(speaker-stats): begin polling for stats after mount

master
Leonard Kim 7 years ago
parent
commit
1e3e71c2ff
1 changed files with 8 additions and 11 deletions
  1. 8
    11
      react/features/speaker-stats/components/SpeakerStats.js

+ 8
- 11
react/features/speaker-stats/components/SpeakerStats.js View File

12
 declare var interfaceConfig: Object;
12
 declare var interfaceConfig: Object;
13
 
13
 
14
 /**
14
 /**
15
- * The type of the React {@code Component} props of {@link SpeakerStats}
15
+ * The type of the React {@code Component} props of {@link SpeakerStats}.
16
  */
16
  */
17
 type Props = {
17
 type Props = {
18
 
18
 
33
 };
33
 };
34
 
34
 
35
 /**
35
 /**
36
- * The type of the React {@code Component} state of {@link SpeakerStats}
36
+ * The type of the React {@code Component} state of {@link SpeakerStats}.
37
  */
37
  */
38
 type State = {
38
 type State = {
39
 
39
 
49
  * @extends Component
49
  * @extends Component
50
  */
50
  */
51
 class SpeakerStats extends Component<Props, State> {
51
 class SpeakerStats extends Component<Props, State> {
52
-    state = {
53
-        stats: {}
54
-    };
55
-
56
     _updateInterval: IntervalID;
52
     _updateInterval: IntervalID;
57
 
53
 
58
     /**
54
     /**
64
     constructor(props) {
60
     constructor(props) {
65
         super(props);
61
         super(props);
66
 
62
 
63
+        this.state = {
64
+            stats: this.props.conference.getSpeakerStats()
65
+        };
66
+
67
         // Bind event handlers so they are only bound once per instance.
67
         // Bind event handlers so they are only bound once per instance.
68
         this._updateStats = this._updateStats.bind(this);
68
         this._updateStats = this._updateStats.bind(this);
69
     }
69
     }
70
 
70
 
71
     /**
71
     /**
72
-     * Immediately request for updated speaker stats and begin
73
-     * polling for speaker stats updates.
72
+     * Begin polling for speaker stats updates.
74
      *
73
      *
75
      * @inheritdoc
74
      * @inheritdoc
76
-     * @returns {void}
77
      */
75
      */
78
-    componentWillMount() {
79
-        this._updateStats();
76
+    componentDidMount() {
80
         this._updateInterval = setInterval(this._updateStats, 1000);
77
         this._updateInterval = setInterval(this._updateStats, 1000);
81
     }
78
     }
82
 
79
 

Loading…
Cancel
Save