@woosh/meep-engine
Version:
Pure JavaScript game engine. Fully featured and production ready.
52 lines (43 loc) • 1.06 kB
JavaScript
import { MetricStatistics } from "./MetricStatistics.js";
export class AbstractMetric {
/**
*
* @param {number} value
* @returns {void}
*/
record(value) {
throw new Error('Not implemented');
}
/**
* @returns {number|undefined}
*/
getLastRecord() {
throw new Error('Not implemented');
}
/**
*
* @param {MetricStatistics} result
* @returns {boolean} whether metric was successfully computed or not
*/
computeStats(result) {
throw new Error('Not implemented');
}
/**
* Shortcut to {@link computeStats}
* Use the other one if you want to avoid memory allocation
* @return {MetricStatistics}
*/
get stats() {
const stats = new MetricStatistics();
this.computeStats(stats);
return stats;
}
clear() {
throw new Error('Not implemented');
}
}
/**
* @readonly
* @type {boolean}
*/
AbstractMetric.prototype.isMetric = true;