Firebase Tutorial
Firebase Useful Resources
Selected Reading
- Firebase - Deploying
- Firebase - Security
- Firebase - Offline Capabilities
- Anonymous Authentication
- Firebase - Github Authentication
- Firebase - Twitter Authentication
- Firebase - Facebook Authentication
- Firebase - Google Authentication
- Firebase - Email Authentication
- Firebase - Best Practices
- Firebase - Filtering Data
- Firebase - Queries
- Firebase - Detaching Callbacks
- Firebase - Event Types
- Firebase - Read Data
- Firebase - Write Transactional Data
- Firebase - Write List Data
- Firebase - Write Data
- Firebase - Arrays
- Firebase - Data
- Firebase - Environment Setup
- Firebase - Overview
- Firebase - Home
Firebase Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Firebase - Detaching Callbacks
Firebase - Detaching Callbacks
This chapter will show you how to detach callbacks in Firebase.
Detach Callback for Event Type
Let us say we want to detach a callback for a function with value event type.
Example
var playersRef = firebase.database().ref("players/"); ref.on("value", function(data) { console.log(data.val()); }, function (error) { console.log("Error: " + error.code); });
We need to use off() method. This will remove all callbacks with value event type.
playersRef.off("value");
Detach All Callbacks
When we want to detach all callbacks, we can use −
playersRef.off();Advertisements