Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase v3 - How to Reinitialize Default App?

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?

like image 366
Ronnie Royston Avatar asked Jun 02 '16 04:06

Ronnie Royston


1 Answers

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();
like image 189
Channing Huang Avatar answered Sep 18 '22 15:09

Channing Huang