Firebase Stub: debounce callback called by "on" function

This commit is contained in:
gianantoniopini
2021-01-11 16:18:38 +01:00
parent dce5d2c591
commit 6c1fc543ad
5 changed files with 51 additions and 31 deletions

View File

@ -1,4 +1,5 @@
import { v4 as uuidv4 } from 'uuid';
import { debounce } from 'lodash';
import DatabaseConstants from '../constants/database';
import DataSnapshot from './dataSnapshot';
@ -108,7 +109,8 @@ class Reference {
snapshot = new DataSnapshot(eventType, () => this.getData());
}
callback(snapshot);
const debouncedCallback = debounce(callback, 100);
debouncedCallback(snapshot);
}
async once(eventType) {