-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsnapshot.js
39 lines (28 loc) · 951 Bytes
/
snapshot.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
"use strict";
exports.__esModule = true;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function getPluginName(plugin) {
if (plugin.postcss) {
plugin = plugin.postcss;
}
return plugin.postcssPlugin;
}
var Snapshot = function () {
function Snapshot(css, _ref) {
var prevPlugin = _ref.prevPlugin;
var nextPlugin = _ref.nextPlugin;
_classCallCheck(this, Snapshot);
this.css = css.toString();
this.timestamp = Date.now();
this.prevPlugin = prevPlugin && getPluginName(prevPlugin);
this.nextPlugin = nextPlugin && getPluginName(nextPlugin);
}
Snapshot.prototype.isFirstSnapshot = function isFirstSnapshot() {
return !this.prevPlugin;
};
Snapshot.prototype.isLastSnapshot = function isLastSnapshot() {
return !this.nextPlugin;
};
return Snapshot;
}();
exports.default = Snapshot;