/
index.js
48 lines (42 loc) · 1.06 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import {StatelessSparkPlugin} from '@ciscospark/spark-core';
import {MEETINGS, LOCUSEVENT, LOCUS_URL} from '../constants';
import Meetings from '../meetings';
import LocusParser from './parser';
/**
* @class LocusEvents
*/
export default class LocusEvents extends StatelessSparkPlugin {
namespace = MEETINGS;
/**
*
* @param {Object} attrs
* @param {Object} options
*/
constructor(attrs, options) {
super({}, options);
this.parser = new LocusParser({}, options);
}
/**
* @param {Object} data
* @returns {undefined}
* @memberof LocusEvents
*/
locusEvent(data) {
const {eventType} = data;
console.log('Mercury-Locus-Event', eventType);
if (eventType === LOCUSEVENT.MESSAGE_ROAP) {
return;
}
const meeting = Meetings.getMeetingByType(LOCUS_URL, data.locusUrl);
this.parser.parse(meeting, data);
}
/**
* @returns {undefined}
* @memberof LocusEvents
*/
start() {
this.spark.internal.mercury.on(LOCUSEVENT.LOCUS_MERCURY, (envelope) => {
this.locusEvent(envelope.data);
});
}
}