As a Polymer (plus Firebase) app user,
when I start the app offline,
I want data input to "just work",
so that I don't have be online to use the app.
The Firebase client library has a "hidden" cold boot mode. Here is an example of how you use it:
// always online ref
var onlineRef = new Firebase("https://my.firebaseio.com");
// always offline ref
var offlineRef = new Firebase("https://my.firebaseio.com", "__offline__");
offlineRef.goOffline();
The second parameter (__offline__) allows the Firebase instance to be booted up and respond to local data changes caused by other such Firebase instances in the app. This is a very useful feature for implementing a "cold boot" mode for Firebase.
In order for this feature to work, the app's online / offline state needs to be monitored. When offline, the "offline" Firebase ref should be used. Then, when transitioning to the online state, the element should switch to using the "online" Firebase ref.
As a Polymer (plus Firebase) app user, when I start the app offline, I want data input to "just work", so that I don't have be online to use the app.
The Firebase client library has a "hidden" cold boot mode. Here is an example of how you use it:
The second parameter (
__offline__
) allows the Firebase instance to be booted up and respond to local data changes caused by other such Firebase instances in the app. This is a very useful feature for implementing a "cold boot" mode for Firebase.In order for this feature to work, the app's online / offline state needs to be monitored. When offline, the "offline" Firebase ref should be used. Then, when transitioning to the online state, the element should switch to using the "online" Firebase ref.