Firebase v3 - How to Reinitialize Default App?

断了今生、忘了曾经 提交于 2020-01-14 02:14:27

问题


If I modify the initializeApp config object parameters via scripting how could I reinitialize the app to use the new values?

The only way it works now is to reload/refresh the page.

Any ideas?


回答1:


You can delete and then reinitialize the the app with

firebase.app().delete().then(function() {
  firebase.initializeApp(myNewConfig);
});

Alternatively, you can keep the old app around and initialize a new app with a different name:

firebase.initializeApp(myConfig1);
firebase.initializeApp(myConfig2, 'myOtherApp');

var db1 = firebase.database();
var db2 = firebase.app('myOtherApp').database();


来源:https://stackoverflow.com/questions/37582860/firebase-v3-how-to-reinitialize-default-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!