blob: 5f8e2ae1e254b34f421f94db9f5fa3a18d1a4ab7 (
plain)
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
51
52
53
54
55
56
57
|
"use strict";
const api = require("../api.js");
const events = require("../events.js");
class Snapshot extends events.EventTarget {
constructor() {
super();
this._orig = {};
this._updateFromResponse({});
}
get operation() {
return this._operation;
}
get type() {
return this._type;
}
get id() {
return this._id;
}
get user() {
return this._user;
}
get data() {
return this._data;
}
get time() {
return this._time;
}
static fromResponse(response) {
const ret = new Snapshot();
ret._updateFromResponse(response);
return ret;
}
_updateFromResponse(response) {
const map = {
_operation: response.operation,
_type: response.type,
_id: response.id,
_user: response.user,
_data: response.data,
_time: response.time,
};
Object.assign(this, map);
}
}
module.exports = Snapshot;
|