@woosh/meep-engine
Version:
Pure JavaScript game engine. Fully featured and production ready.
35 lines (27 loc) • 715 B
JavaScript
import { MetricsGateway } from "./MetricsGateway.js";
import { NullMetricsGateway } from "./NullMetricsGateway.js";
import { assert } from "../../core/assert.js";
/**
* Forwards metrics to another gateway
*/
export class ProxyMetricsGateway extends MetricsGateway {
constructor() {
super();
/**
*
* @type {MetricsGateway}
*/
this.target = NullMetricsGateway.INSTANCE;
}
/**
*
* @param {MetricsGateway} gateway
*/
setTarget(gateway) {
assert.defined(gateway, 'gateway');
this.target = gateway;
}
record(type, event) {
this.target.record(type, event);
}
}