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 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 small and simple Store
.
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