|
@@ -4,12 +4,22 @@
|
4
|
4
|
export default class AbstractHandler {
|
5
|
5
|
/**
|
6
|
6
|
* Creates new instance.
|
|
7
|
+ *
|
|
8
|
+ * @param {Object} options - Optional parameters.
|
7
|
9
|
*/
|
8
|
|
- constructor() {
|
|
10
|
+ constructor(options = {}) {
|
9
|
11
|
this._enabled = false;
|
10
|
|
- this._ignoredEvents
|
11
|
|
- = [ 'e2e_rtt', 'rtp.stats', 'rtt.by.region', 'available.device',
|
12
|
|
- 'stream.switch.delay', 'ice.state.changed', 'ice.duration' ];
|
|
12
|
+ this._whiteListedEvents = options.whiteListedEvents;
|
|
13
|
+
|
|
14
|
+ // FIXME:
|
|
15
|
+ // Keeping the list with the very noisy events so that we don't flood with events whoever hasn't configured
|
|
16
|
+ // white/black lists yet. We need to solve this issue properly by either making these events not so noisy or
|
|
17
|
+ // by removing them completely from the code.
|
|
18
|
+ this._blackListedEvents = [
|
|
19
|
+ ...(options.blackListedEvents || []), // eslint-disable-line no-extra-parens
|
|
20
|
+ 'e2e_rtt', 'rtp.stats', 'rtt.by.region', 'available.device', 'stream.switch.delay', 'ice.state.changed',
|
|
21
|
+ 'ice.duration'
|
|
22
|
+ ];
|
13
|
23
|
}
|
14
|
24
|
|
15
|
25
|
/**
|
|
@@ -60,7 +70,16 @@ export default class AbstractHandler {
|
60
|
70
|
return true;
|
61
|
71
|
}
|
62
|
72
|
|
63
|
|
- // Temporary removing some of the events that are too noisy.
|
64
|
|
- return this._ignoredEvents.indexOf(event.action) !== -1;
|
|
73
|
+ const name = this._extractName(event);
|
|
74
|
+
|
|
75
|
+ if (Array.isArray(this._whiteListedEvents)) {
|
|
76
|
+ return this._whiteListedEvents.indexOf(name) === -1;
|
|
77
|
+ }
|
|
78
|
+
|
|
79
|
+ if (Array.isArray(this._blackListedEvents)) {
|
|
80
|
+ return this._blackListedEvents.indexOf(name) !== -1;
|
|
81
|
+ }
|
|
82
|
+
|
|
83
|
+ return false;
|
65
|
84
|
}
|
66
|
85
|
}
|