TinyBase logoTinyBase

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
returnsMetricsListenerStats

A MetricsListenerStats object containing Metrics listener statistics.

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.

import {createMetrics, createStore} from 'tinybase';

const store = createStore();
const metrics = createMetrics(store);
metrics.addMetricListener(null, () => console.log('Metric changed'));

console.log(metrics.getListenerStats());
// -> {metric: 1}

Since

v1.0.0