-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevent_model.js
More file actions
50 lines (44 loc) · 1.41 KB
/
event_model.js
File metadata and controls
50 lines (44 loc) · 1.41 KB
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
49
50
/**
* @param {String} sessionID
* @param {String} sessionType
* @param {String} sessionName
* @param {String} sessionUnixTimestamp
* @param {String} eventID
* @param {String} eventType
* @param {String} eventName
* @param {String} message
* @param {number} unixTimestamp
*/
class Event {
constructor({sessionID=null ,sessionType=null,sessionName=null, sessionUnixTimestamp=null, eventID=null, eventType=null , eventName=null, message=null, eventUnixTimestamp=null}) {
this.sessionID = sessionID ;
this.sessionType = sessionType;
this.sessionName =sessionName;
this.sessionUnixTimestamp =sessionUnixTimestamp;
this.eventID = eventID;
this.eventType = eventType;
this.eventName = eventName;
this.message = message;
this.eventUnixTimestamp = Date.now()
}
/**
* @returns {Map}
*/
getArgumentsMap() {
const argsMap = new Map();
argsMap.set('sessionID', this.sessionID);
argsMap.set('sessionType', this.sessionType);
argsMap.set('sessionName', this.sessionName);
argsMap.set('sessionUnixTimestamp', this.sessionUnixTimestamp)
argsMap.set('eventID', this.eventID);
argsMap.set('eventType', this.eventType);
argsMap.set('eventName', this.eventName);
argsMap.set('message', this.message);
argsMap.set('unixTimestamp', this.eventUnixTimestamp)
return argsMap;
}
toJsonString() {
return JSON.stringify(this);
}
}
module.exports = Event;