[docs][core] apps

This commit is contained in:
Salakar 2017-10-05 05:14:43 +01:00
parent 8ce398cf9a
commit 148bd66dfb
3 changed files with 22 additions and 27 deletions

View File

@ -1,21 +1,21 @@
# App - firebase.app(): FirebaseApp ## Apps
RNFirebase supports both initializing apps natively and also via js code over the RN bridge. ?> For the **default** app see: [Default App](/core/default-app)
Apps initialized natively are available immediately at app runtime, there is no need to call `initializeApp` for them. ?> For initializing **additional apps** natively and also via js code over the RN bridge see: [Dynamically Initializing Apps](/core/initialize-apps)
For example, to access the default app initialized via the `Google-Services` `plist` or `json` file: ### Reading App Options
!> `<app>.options.clientId` is not available on the **Android Firebase SDK** so will return null for Android, see the issue: [firebase/firebase-ios-sdk#140 (comment)](https://github.com/firebase/firebase-ios-sdk/issues/140#issuecomment-315953708)
Just like the Firebase web sdk you can view options used to initialize an app instance in the same way, for example:
```js ```js
import firebase from 'react-native-firebase'; import firebase from 'react-native-firebase';
const defaultApp = firebase.app(); const defaultApp = firebase.app();
defaultApp.database().ref('foobar').once('value', (snapshot) => { // get the default app name/options that the app initialized with
// snapshot from default app
});
// get the default app name/options that were initialized natively
console.log("name", defaultApp.name); console.log("name", defaultApp.name);
console.log("apiKey", defaultApp.options.apiKey); console.log("apiKey", defaultApp.options.apiKey);
console.log("applicationId", defaultApp.options.applicationId); console.log("applicationId", defaultApp.options.applicationId);
@ -26,9 +26,3 @@ console.log("storageBucket", defaultApp.options.projectId);
``` ```
<!-- TODO api ref docs: -->
<!-- - name: String -->
<!-- - options: Object -->
<!-- - delete(): Promise -->

View File

@ -1,9 +1,10 @@
# Firebase # Firebase
<!-- TODO api ref docs --> TODO Reference Docs:
<!-- TODO - apps(): Array<FirebaseApp> -->
<!-- TODO - app(): FirebaseApp --> - apps(): Array<FirebaseApp>
<!-- TODO - initializeApp(): FirebaseApp --> - app(): FirebaseApp
<!-- TODO - setLogLevel() --> - initializeApp(): FirebaseApp
<!-- TODO - SDK_VERSION: String --> - setLogLevel()
<!-- TODO - googleApiAvailability: Object --> - SDK_VERSION: String
- googleApiAvailability: Object

View File

@ -45,11 +45,11 @@
], ],
} }
</script> </script>
<script> <!--<script>-->
if (typeof navigator.serviceWorker !== 'undefined') { <!--if (typeof navigator.serviceWorker !== 'undefined') {-->
navigator.serviceWorker.register('sw.js') <!--navigator.serviceWorker.register('sw.js')-->
} <!--}-->
</script> <!--</script>-->
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css"> <link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
<style> <style>
.markdown-section pre>code { .markdown-section pre>code {