Files
jasmine/src/core/Timer.js
2022-06-09 20:00:23 -07:00

25 lines
441 B
JavaScript

getJasmineRequireObj().Timer = function() {
const defaultNow = (function(Date) {
return function() {
return new Date().getTime();
};
})(Date);
function Timer(options) {
options = options || {};
const now = options.now || defaultNow;
let startTime;
this.start = function() {
startTime = now();
};
this.elapsed = function() {
return now() - startTime;
};
}
return Timer;
};