How to use the @firebase/app.firebase.database function in @firebase/app

To help you get started, we’ve selected a few @firebase/app examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hand-dot / taskontable / src / utils / util.js View on Github external
import wkn from 'wkn';
import constants from '../constants';
import firebaseConf from '../configs/firebase';

const parser = new UAParser();
const browserName = parser.getBrowser().name;
const osName = parser.getOS().name;
const deviceType = parser.getDevice().type;

let database;
let auth;
let messaging;
let storage;
if (process.env.NODE_ENV !== 'test') {
  firebase.initializeApp(firebaseConf);
  database = firebase.database();
  auth = firebase.auth();
  if (constants.SUPPORTEDBROWSERS.indexOf(browserName) >= 0 && osName !== 'iOS') { // safari,iosではエラーになるため
    messaging = firebase.messaging();
  }
  storage = firebase.storage();
}

export default {
  /**
   * firebaseのdatabaseを返します。
   */
  getDatabase() {
    return database;
  },
  /**
   * firebaseのauthを返します。
github popcodeorg / popcode / src / services / appFirebase.js View on Github external
import {firebase} from '@firebase/app';
import '@firebase/auth';
import '@firebase/database';
import config from '../config';

const appFirebase = firebase.initializeApp({
  apiKey: config.firebaseApiKey,
  authDomain: `${config.firebaseApp}.firebaseapp.com`,
  databaseURL: `https://${config.firebaseApp}.firebaseio.com`,
});

const auth = firebase.auth(appFirebase);
const database = firebase.database(appFirebase);
const githubAuthProvider = new firebase.auth.GithubAuthProvider();
githubAuthProvider.addScope('gist');
githubAuthProvider.addScope('public_repo');

export {auth, database, githubAuthProvider};