getListenerStats
The getListenerStats
method provides a set of statistics about the listeners registered with the Indexes
object, and is used for debugging purposes.
getListenerStats(): IndexesListenerStats
returns | IndexesListenerStats | A |
---|
The IndexesListenerStats
object contains a breakdown of the different types of listener.
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 an Indexes
object.
import {createIndexes, createStore} from 'tinybase';
const store = createStore();
const indexes = createIndexes(store);
indexes.addSliceIdsListener(null, () => {
console.log('Slice Ids changed');
});
indexes.addSliceRowIdsListener(null, null, () => {
console.log('Slice Row Ids changed');
});
console.log(indexes.getListenerStats());
// -> {sliceIds: 1, sliceRowIds: 1}
Since
v1.0.0