getListenerStats
The getListenerStats
method provides a set of statistics about the listeners registered with the Store
, and is used for debugging purposes.
getListenerStats(): StoreListenerStats
returns | StoreListenerStats | A |
---|
The StoreListenerStats
object contains a breakdown of the different types of listener. Totals include both mutator and non-mutator listeners.
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 small and simple Store
.
import {createStore} from 'tinybase';
const store = createStore();
store.addTablesListener(() => console.log('Tables changed'));
store.addRowIdsListener(() => console.log('Row Ids changed'));
const listenerStats = store.getListenerStats();
console.log(listenerStats.rowIds);
// -> 1
console.log(listenerStats.tables);
// -> 1
Since
v1.0.0