/* Copyright (c) 2020, 2023, The Unified Company. This code is part of Unify. This program is free software; you can redistribute it and/or modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE, as published by the Free Software Foundation. See the GNU AFFERO GENERAL PUBLIC LICENSE, for more details. https://unifyjs.org */ export default class timer{ timings = new Array(); initialising = true; lap( name ) { var timing = new Object(); timing.time = new Date().getTime(); timing.name = name; if( this.timings.length > 0 ) { var previouseTiming = this.timings[this.timings.length - 1].time; var timeBetweenPrev = ( timing.time - previouseTiming ) / 1000 ; var firstTiming = this.timings[0].time; var timeSinceFirst = ( timing.time - firstTiming ) / 1000 ; //console.log("TimeBetween", timeBetweenPrev); console.log("Time: ", timeSinceFirst, name); } this.timings.push( timing ); //console.log("TimeBetween", this.timings); } }