本文整理汇总了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);
}
}
示例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;
}
}
示例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();
}
示例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
});
}
示例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);
}
示例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 });
}
示例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;
}
示例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);
}
示例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});
}
示例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();