surrogate
Version:
Object method hooks made easy
53 lines (50 loc) • 1.43 kB
JavaScript
class $44a14c3e6a2aa393$export$2726b3852afd85de {
getStartTime() {
return Date.now() - this.getTotalDuration();
}
getHookStartTime() {
return this.getStartTime() + (this.hookStartTime - this.startTime);
}
getLastRunDuration() {
const [hookStart, hookEnd] = this.lastRun;
return hookEnd - hookStart;
}
getTotalDuration() {
return this.getNow() - this.startTime;
}
getDurationSinceLastRun() {
const lastRun = this.lastRunEnd;
return this.getNow() - lastRun;
}
setHookStart() {
this.hookStartTime = this.getNow();
}
setHookEnd() {
this.hookTimes.push([
this.hookStartTime,
this.getNow()
]);
}
get lastRun() {
const [hookStart, hookEnd] = this.hookTimes[this.hookTimes.length - 1] ?? [];
return [
hookStart ?? this.startTime,
hookEnd ?? this.getNow()
];
}
get lastRunStart() {
const [hookStart] = this.lastRun;
return hookStart;
}
get lastRunEnd() {
const [, hookEnd] = this.lastRun;
return hookEnd;
}
constructor(){
this.hookTimes = [];
this.nanosecondsInMilliseconds = 1000000;
this.nanosecondsInSeconds = 1000000000;
}
}
export {$44a14c3e6a2aa393$export$2726b3852afd85de as Trackable};
//# sourceMappingURL=surrogate.b80188a3.js.map