Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ulixee
GitHub Repository: ulixee/secret-agent
Path: blob/main/replay/backend/api/ReplayTime.ts
1030 views
1
export default class ReplayTime {
2
public millis = 0;
3
public start: Date;
4
public close?: Date;
5
6
constructor(start: Date, close?: Date) {
7
this.start = start;
8
this.close = close;
9
this.update(close);
10
}
11
12
public update(close?: Date) {
13
this.close = close;
14
const start = this.start;
15
if (close) {
16
this.millis = close.getTime() - start.getTime();
17
} else {
18
// add 10 seconds to end time
19
this.millis = (new Date().getTime() - start.getTime()) * 1.25;
20
}
21
}
22
}
23
24