orbit-db/examples/Timer.js
2016-02-03 17:25:51 +07:00

19 lines
350 B
JavaScript

'use strict';
class Timer {
constructor(startImmediately) {
this.startTime = startImmediately ? new Date().getTime() : null;
this.endTime = null;
}
start() {
this.startTime = new Date().getTime();
}
stop() {
this.endTime = new Date().getTime();
return (this.endTime - this.startTime);
}
}
module.exports = Timer;