當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript app.initializeApp函數代碼示例

本文整理匯總了TypeScript中firebase/app.initializeApp函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript initializeApp函數的具體用法?TypeScript initializeApp怎麽用?TypeScript initializeApp使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了initializeApp函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: _firebaseAppFactory

export function _firebaseAppFactory(config: {}, appName?: string): FirebaseApp {
  try {
    if (appName) {
      return firebase.initializeApp(config, appName);
    } else {
      return firebase.initializeApp(config);
    }
  }
  catch (e) {
    return firebase.app(null);
  }
}
開發者ID:julienevano,項目名稱:angularfire2,代碼行數:12,代碼來源:firebase.app.module.ts

示例2: _firebaseAppFactory

export function _firebaseAppFactory(config: FirebaseAppConfig, appName?: string): FirebaseApp {
  try {
    if (appName) {
      return firebase.initializeApp(config, appName) as FirebaseApp;
    } else {
      return firebase.initializeApp(config) as FirebaseApp;
    }
  }
  catch (e) {
    if (e.code === "app/duplicate-app") {
      return firebase.app(e.name) as FirebaseApp;
    }

    return firebase.app(null!) as FirebaseApp;
  }
}
開發者ID:cartant,項目名稱:angularfire2,代碼行數:16,代碼來源:firebase.app.module.ts

示例3: newFirebaseClient

	function newFirebaseClient(port) {
		const name = `test-firebase-http-${sequentialConnectionId++}`;
		const url = `ws://localhost:${port}`;
		const config = {
			databaseURL: url,
		};
		app = firebase.initializeApp(config, name);
		return app.database().ref();
	}
開發者ID:urish,項目名稱:firebase-server,代碼行數:9,代碼來源:http-server.spec.ts

示例4: initializeFirebaseApp

export function initializeFirebaseApp() {
  firebase.initializeApp({
    apiKey: process.env.FIREBASE_API_KEY,
    authDomain: process.env.FIREBASE_AUTH_DOMAIN,
    databaseURL: process.env.FIREBASE_DATABASE_URL,
    storageBucket: process.env.FIREBASE_STORAGE_BUCKET,
    messagingSenderId: process.env.FIREBASE_MESSAGING_SENDER_ID
  });
}
開發者ID:vdsabev,項目名稱:betahaus-sofia-office-manager,代碼行數:9,代碼來源:firebase.ts

示例5: constructor

 constructor(){
   this.fireBaseUrl = 'https://customer-manager-application.firebaseio.com/';
   this.fbConfig = {
     apiKey: "AIzaSyAFIe8-VH4N1GzUAEsHgUPdV6NFm4i0HWo",
     authDomain: "localhost",
     databaseURL: this.fireBaseUrl,
     storageBucket: "customer-manager-application.appspot.com",
   };
   firebase.initializeApp(this.fbConfig);
 }
開發者ID:bhaniel,項目名稱:angular2-webpack,代碼行數:10,代碼來源:app.component.ts

示例6:

const loadEnvironment = (application:any, environment:any) => {
    const config = Object.assign({}, environment);
    delete config.options;
    delete config.name;
    const options = Object.assign({}, config.options);
    options.name = options.name || environment.name;
    firebase.initializeApp(config, options);
    const serviceName = options.name === '[DEFAULT]' && `firebase-app` || `firebase-${options.name}`;
    application.register(`service:${serviceName}`, FirebaseAppService.extend({ name: options.name }), { instantiate: true });
}
開發者ID:firebase,項目名稱:emberfire,代碼行數:10,代碼來源:emberfire.ts

示例7: _firebaseAppFactory

export function _firebaseAppFactory(options: FirebaseOptions, nameOrConfig?: string|FirebaseAppConfig|null) {
    const name = typeof nameOrConfig === 'string' && nameOrConfig || '[DEFAULT]';
    const config = typeof nameOrConfig === 'object' && nameOrConfig || {};
    config.name = config.name || name;
    // Added any due to some inconsistency between @firebase/app and firebase types
    const existingApp = firebase.apps.filter(app => app && app.name === config.name)[0] as any;
    // We support FirebaseConfig, initializeApp's public type only accepts string; need to cast as any
    // Could be solved with https://github.com/firebase/firebase-js-sdk/pull/1206
    return (existingApp || firebase.initializeApp(options, config as any)) as FirebaseApp;
}
開發者ID:PaulD11,項目名稱:angularfire2,代碼行數:10,代碼來源:firebase.app.module.ts

示例8: constructor

	constructor(public router: Router) {
		const firebaseConfig = {
			apiKey: "AIzaSyCVsm1c-nS9qS1fFfFo6JCAb908AfPU6Ag",
			authDomain: "rin-anidb.firebaseapp.com",
			databaseURL: "https://rin-anidb.firebaseio.com",
			projectId: "rin-anidb",
			storageBucket: "rin-anidb.appspot.com",
			messagingSenderId: "669722574117",
		};

		initializeApp(firebaseConfig);
	}
開發者ID:RinMinase,項目名稱:anidb,代碼行數:12,代碼來源:app.component.ts

示例9: constructor

 constructor() {
     const firebaseConfig = {
         apiKey: "AIzaSyBw73BRk-qWeZm-fp3-Ijf7s0EemdaWuCQ",
         authDomain: "selecquest.firebaseapp.com",
         databaseURL: "https://selecquest.firebaseio.com",
         projectId: "selecquest",
         storageBucket: "selecquest.appspot.com",
         messagingSenderId: "434339253679"
     };
     firebase.initializeApp(firebaseConfig);
     this.db = firebase.firestore()
     this.db.enablePersistence({experimentalTabSynchronization: true});
 }
開發者ID:scunningham777,項目名稱:SelecQuest,代碼行數:13,代碼來源:game-settings-manager.ts

示例10:

import firebase from "firebase/app";
import "firebase/auth";
import "firebase/firestore";

firebase.initializeApp({
  apiKey: "AIzaSyCjBDyhwbXcp9kEIA2pMHLDGxmCM4Sn6Eg",
  authDomain: "canigraduate-43286.firebaseapp.com",
  projectId: "canigraduate-43286"
});

export const firestore = firebase.firestore();
firestore.settings({ timestampsInSnapshots: true });

export const auth = firebase.auth();
開發者ID:kevmo314,項目名稱:canigraduate.uchicago.edu,代碼行數:14,代碼來源:firebase.ts


注:本文中的firebase/app.initializeApp函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。