class FPS {
	private times: number[] = [];

	tick() {
		const times = this.times;
		const now = performance.now();
		while (times.length > 0 && times[0] <= now - 1000) {
			times.shift();
		}
		times.push(now);
	}

	get fps() {
		return this.times.length;
	}
}

export default FPS;
