class Time { constructor() { /** * @type {Number} */ this._last_frame = undefined; /** * @type {Number} */ this._current_frame = undefined; } deltaTime() { if (this._last_frame === undefined) return 0; return (this._current_frame - this._last_frame); } deltaTimeSecond() { return this.deltaTime() / 1000; } get_fps() { return 1 / this.deltaTimeSecond(); } new_frame() { this._last_frame = this._current_frame; this._current_frame = Date.now(); } } export { Time }