You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.
In a scenario where the plugin will be used in many views (many view modules) the plugin has to initialize for each module where it is included, isn't that right?
But this firebase.instance variable is not used anywhere in the code. Initialization for android has the following code for line 90:
firebase.init=function(arg){returnnewPromise(function(resolve,reject){try{varFirebase=com.firebase.client.Firebase;Firebase.setAndroidContext(appModule.android.context);instance=newFirebase(arg.url);resolve(instance);}catch(ex){console.log("Error in firebase.init: "+ex);reject(ex);}});};
Therefore line 90 creates a new varible called instance and pass it to the resolve() function of the promise.
Is this the expected behavior? A user really has to init the firebase plugin for every module where it will be used? I assumed the firebase.instance variable would be a module cached reference to the first initialization and that every module would use the same instance.
The text was updated successfully, but these errors were encountered:
afortaleza
changed the title
New instance in every module?
Call init for every module?
Feb 2, 2016
I ended up doing a
var firebase = require("nativescript-plugin-firebase");
in my app.js file.
Then in the onApplicationLaunch event, I do the init. From here, I think the firebase variable is cached throughout the app and is globally available and you can just call firebase.whatever. I've been able to perform sets and pushes from various pages, but I'll be testing to make sure that things work throughout.
In a scenario where the plugin will be used in many views (many view modules) the plugin has to initialize for each module where it is included, isn't that right?
File
firebase-common.js
line 26 has this:But this
firebase.instance
variable is not used anywhere in the code. Initialization for android has the following code for line 90:Therefore line 90 creates a new varible called
instance
and pass it to theresolve()
function of the promise.Is this the expected behavior? A user really has to init the firebase plugin for every module where it will be used? I assumed the
firebase.instance
variable would be a module cached reference to the first initialization and that every module would use the same instance.The text was updated successfully, but these errors were encountered: