getListenerStats
The getListenerStats
method provides a set of statistics about the listeners registered with the Metrics
object, and is used for debugging purposes.
getListenerStats(): MetricsListenerStats
returns | MetricsListenerStats | A |
---|
The statistics are only populated in a debug build: production builds return an empty object. The method is intended to be used during development to ensure your application is not leaking listener registrations, for example.
Example
This example gets the listener statistics of a Metrics
object.
const store = createStore();
const metrics = createMetrics(store);
metrics.addMetricListener(null, () => console.log('Metric changed'));
console.log(metrics.getListenerStats());
// -> {metric: 1}