Я хотел бы знать, есть ли способ остановить обратный вызов внутри самого обратного вызова.Я попытался использовать метод ref.off (), чтобы остановить его, как показано ниже, но он все равно будет продолжать работать.Есть предложения?
ref.orderByChild('t').startAt(time.getTime()).on('child_added', function (snapshot) {
const d = snapshot.val();
const x = Math.round(d.x * 100).toString();
const y = Math.round(d.y * 100).toString();
if (that.selectedEnd && d.t > that.selectedEnd.getTime()) {
snapshot.ref.off('child_added');
console.log('STOP');
} else {
....
}
});