Преглед изворни кода

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

master
Leonard Kim пре 7 година
родитељ
комит
1e3e71c2ff
1 измењених фајлова са 8 додато и 11 уклоњено
  1. 8
    11
      react/features/speaker-stats/components/SpeakerStats.js

+ 8
- 11
react/features/speaker-stats/components/SpeakerStats.js Прегледај датотеку

@@ -12,7 +12,7 @@ import SpeakerStatsLabels from './SpeakerStatsLabels';
12 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 17
 type Props = {
18 18
 
@@ -33,7 +33,7 @@ type Props = {
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 38
 type State = {
39 39
 
@@ -49,10 +49,6 @@ type State = {
49 49
  * @extends Component
50 50
  */
51 51
 class SpeakerStats extends Component<Props, State> {
52
-    state = {
53
-        stats: {}
54
-    };
55
-
56 52
     _updateInterval: IntervalID;
57 53
 
58 54
     /**
@@ -64,19 +60,20 @@ class SpeakerStats extends Component<Props, State> {
64 60
     constructor(props) {
65 61
         super(props);
66 62
 
63
+        this.state = {
64
+            stats: this.props.conference.getSpeakerStats()
65
+        };
66
+
67 67
         // Bind event handlers so they are only bound once per instance.
68 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 74
      * @inheritdoc
76
-     * @returns {void}
77 75
      */
78
-    componentWillMount() {
79
-        this._updateStats();
76
+    componentDidMount() {
80 77
         this._updateInterval = setInterval(this._updateStats, 1000);
81 78
     }
82 79
 

Loading…
Откажи
Сачувај