getListenerStats
The getListenerStats
method provides a set of statistics about the listeners registered with the Checkpoints
object, and is used for debugging purposes.
getListenerStats(): CheckpointsListenerStats
returns | CheckpointsListenerStats | A |
---|
The CheckpointsListenerStats
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 a Checkpoints
object.
import {createCheckpoints, createStore} from 'tinybase';
const store = createStore();
const checkpoints = createCheckpoints(store);
checkpoints.addCheckpointIdsListener(() => {
console.log('Checkpoint Ids changed');
});
checkpoints.addCheckpointListener(null, () => {
console.log('Checkpoint label changed');
});
console.log(checkpoints.getListenerStats());
// -> {checkpointIds: 1, checkpoint: 1}
Since
v1.0.0