mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-25 15:32:40 -05:00
20 lines
323 B
JavaScript
20 lines
323 B
JavaScript
/**
|
|
* Constructor
|
|
*/
|
|
function Timer () {
|
|
this.startTime = 0;
|
|
}
|
|
|
|
Timer.prototype.time = function () {
|
|
return Date.now();
|
|
};
|
|
|
|
Timer.prototype.start = function () {
|
|
this.startTime = this.time();
|
|
};
|
|
|
|
Timer.prototype.timeElapsed = function () {
|
|
return this.time() - this.startTime;
|
|
};
|
|
|
|
module.exports = Timer;
|