UNPKG

@lodestar/beacon-node

Version:

A Typescript implementation of the beacon chain

22 lines 538 B
import { Gauge } from "prom-client"; /** * Extends the prom-client Gauge to be able to add multiple collect functions after instantiation */ export class GaugeExtra extends Gauge { constructor() { super(...arguments); this.collectFns = []; } addCollect(collectFn) { this.collectFns.push(collectFn); } /** * @override Metric.collect */ collect() { for (const collectFn of this.collectFns) { collectFn(this); } } } //# sourceMappingURL=gauge.js.map