Reputation: 2310
My database contains:
user: {
'monkey': 'banana',
'bear': 'fish'
}
Why does the event handler not execute?
let db = firebase.database();
let user = db.ref('user');
user.on('child_removed', (e) => {
console.log(e.val());
});
user.child('monkey').remove();
Upvotes: 1
Views: 154
Reputation: 1571
This looks like some race going on with the code, because I tested and if you do something like this:
setTimeout(function() {
user.child('monkey').remove();
},2000);
it seems to work. Here is a fiddle I used to test it out, hope it helps:
Upvotes: 1