Create attractive VASL scenarios, with loads of useful information embedded to assist with game play.
https://vasl-templates.org
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
599 B
27 lines
599 B
/* jshint esnext: true */
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
class PerformanceTimer
|
|
{
|
|
constructor( msg ) {
|
|
// initialize
|
|
if ( msg )
|
|
console.log( "Starting timer:", msg ) ;
|
|
this.startTimer() ;
|
|
}
|
|
|
|
startTimer() {
|
|
// start the timer
|
|
this.startTime = window.performance.now() ;
|
|
return this.startTime ;
|
|
}
|
|
|
|
stopTimer() {
|
|
// stop the timer
|
|
var elapsedTime = window.performance.now() - this.startTime ;
|
|
this.startTime = null ;
|
|
return elapsedTime ;
|
|
}
|
|
|
|
}
|
|
|