Sets whether persistence is enabled for all database calls for the current app instance.
Ensure this is called before any database calls are performed, otherwise persistence will only come into effect when the app is next started.
const db = getDatabase();setPersistenceEnabled(db, true);async function bootstrap() { // Bootstrapping application const snapshot = await ref(db, "settings").once("value");} Copy
const db = getDatabase();setPersistenceEnabled(db, true);async function bootstrap() { // Bootstrapping application const snapshot = await ref(db, "settings").once("value");}
The Database instance.
Whether persistence is enabled for the Database service.
Sets whether persistence is enabled for all database calls for the current app instance.
Example