mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-01-13 02:31:34 -05:00
21 lines
316 B
JavaScript
21 lines
316 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.stop = function () {
|
||
|
return this.startTime - this.time();
|
||
|
};
|
||
|
|
||
|
module.exports = Timer;
|