So I have some code for my firebase project, and it checks when something is changed but it still runs the function even when nothing is in there and i dont want it... check below and please help!!!
<script>
firebase.database().ref('Bolos/').on('value', function(snapshot) {
M.toast({html: '<i class="material-icons">check_circle</i><span>Current Bolos Or Just Updated!'})
});
</script>
Basically What i wanna do is this : When something is added, updated or deleted:
- Run That M.Toast
when reference is empty:
- Do Nothing