Implementing offline capabilities support
Firebase offers the offline experience outside of the box. There's no need to do any magical trick or write any piece of code; all you need to do is to focus on your application logic and exploit the Firebase API in the best way you can. All the changes you will do to the database will be synchronized once connected to a stable connectivity source.
In this recipe, we'll see how we can know whether we're simply connected to our database or not; this feature is simple but can help us enormously in improving our user experience.
Getting ready
In order to have the needed reference point within our application to support the added functionality, simply ensure that your project is fully integrated with Firebase; check Chapter 1, Firebase - Getting Started, for extra information.
How to do it...
- Let's see how we can use the Firebase database API to perform the connection checking functionality:
let miConnected = firebase.database().ref(".info/connected...