getListenerStats
The getListenerStats
method provides a set of statistics about the listeners registered with the Relationships
object, and is used for debugging purposes.
getListenerStats(): RelationshipsListenerStats
returns | RelationshipsListenerStats | A |
---|
The RelationshipsListenerStats
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 Relationships
object.
import {createRelationships, createStore} from 'tinybase';
const store = createStore();
const relationships = createRelationships(store);
relationships.addRemoteRowIdListener(null, null, () => {
console.log('Remote Row Id changed');
});
relationships.addLocalRowIdsListener(null, null, () => {
console.log('Local Row Id changed');
});
const listenerStats = relationships.getListenerStats();
console.log(listenerStats.remoteRowId);
// -> 1
console.log(listenerStats.localRowIds);
// -> 1
Since
v1.0.0