Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getDBListener({ callback, consortiumId, projectId }) {
if (!consortiumId) {
throw new Error('Consortium ID required');
} else if (!callback || !(callback instanceof Function)) {
throw new Error('Callback function required');
}
// Deep props are unfortunately necessary for testing:
const dbListener = new coinstacCommon.helpers.DBListener(
this.dbRegistry.get(`remote-consortium-${consortiumId}`)
);
dbListener.on('change', ({ doc }) => {
ProjectService.handleRemoteResultChange({
callback,
consortiumId,
doc,
projectId,
});
});
dbListener.on('delete', ({ doc }) => {
ProjectService.handleRemoteResultDelete({
callback,
consortiumId,
doc,