本文整理汇总了TypeScript中firebase.initializeApp函数的典型用法代码示例。如果您正苦于以下问题:TypeScript initializeApp函数的具体用法?TypeScript initializeApp怎么用?TypeScript initializeApp使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了initializeApp函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(private platform:Platform) {
// this.rootPage = TabsPage;
// Initialize Firebase
var config = {
apiKey: "AIzaSyBraUpF6f4tA9QuEy2QnO32VQTHccluLvU",
authDomain: "bangbang-474d4.firebaseapp.com",
databaseURL: "https://bangbang-474d4.firebaseio.com",
storageBucket: "bangbang-474d4.appspot.com",
};
firebase.initializeApp(config);
// var CrrUser;
firebase.auth().onAuthStateChanged( (user) => {
if ( user ) {
var userId = firebase.auth().currentUser.uid;
// if there's a user take him to the home page
this.rootPage = TabsPage;
} else {
this.rootPage = LoginPage;
}
});
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
StatusBar.styleDefault();
});
}
示例2: constructor
constructor(platform: Platform) {
// Initialize Firebase
var config = {
apiKey: "AIzaSyDvrfwEXb2iyYXud_27tzJZ3Bcer28DkMg",
authDomain: "fir-auth-d5ba1.firebaseapp.com",
databaseURL: "https://fir-auth-d5ba1.firebaseio.com",
storageBucket: "fir-auth-d5ba1.appspot.com",
};
firebase.initializeApp(config);
firebase.auth().onAuthStateChanged((user) => {
if (user) {
// If there's a user take him to the home page.
this.rootPage = HomePage;
} else {
// If there's no user logged in send him to the LoginPage
this.rootPage = LoginPage;
}
});
platform.ready().
then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
StatusBar.styleDefault();
});
}
示例3: ngOnInit
ngOnInit()
{
firebase.initializeApp({
apiKey: "AIzaSyCl0HAbu80XdmOlsaGLgh1g9sLJZn33uKc",
authDomain: "comprasapp-4496f.firebaseapp.com"
});
}
示例4: Promise
return new Promise((resolve, reject) => {
console.log('Authenticating to Firebase');
const configuration = {
serviceAccount: {
"type": "service_account",
"project_id": Config.FB_PROJECT_ID(),
"private_key_id": Config.FB_PRIVATE_KEY_ID(),
"private_key": `-----BEGIN PRIVATE KEY-----\n${Config.FB_PRIVATE_KEY()}\n-----END PRIVATE KEY-----\n`,
"client_email": Config.FB_CLIENT_EMAIL(),
"client_id": Config.FB_CLIENT_ID(),
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": Config.FB_CLIENT_CERT_URL()
},
databaseURL: firebaseUrl
};
// Init firebase app
$firebaseApp = firebase.initializeApp(configuration);
if ($firebaseApp) {
console.log('Succesfully authenticated to ' + firebaseUrl);
resolve($firebaseApp);
} else {
reject('Cannot auth to Firebase');
}
});
示例5: constructor
constructor(
private platform: Platform,
private menu: MenuController,
private translate: TranslateService
) {
// Initialize Firebase
var config = {
apiKey: "AIzaSyAzFI5_pxrWc6sZWomz7bC5CcHxltt9gRg",
authDomain: "handballstats-8b496.firebaseapp.com",
databaseURL: "https://handballstats-8b496.firebaseio.com",
storageBucket: "handballstats-8b496.appspot.com",
};
firebase.initializeApp(config);
firebase.auth().onAuthStateChanged((user) => {
if (user) {
// If there's a user take him to the home page.
this.rootPage = PrincipalPage;
} else {
// If there's no user logged in send him to the LoginPage
this.rootPage = LoginPage;
}
});
this.initializeApp();
this.translateConfig();
}
示例6: init
export function init(options: FirebaseOptions) {
const fb = Firebase.initializeApp(options);
_database = fb.database();
_auth = fb.auth();
_storage = fb.storage();
}
示例7:
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
StatusBar.styleDefault();
//firebase config here
const
fbConf = {
apiKey: "",
authDomain: "",
databaseURL: "",
storageBucket: "",
};
firebase.initializeApp(fbConf);
firebase.auth().onAuthStateChanged((user) => {
if (user) {
// If there's a user take him to the home page.
this.rootPage = HomePage;
} else {
// If there's no user logged in send him to the LoginPage
this.rootPage = LoginPage;
}
});
});
示例8: constructor
constructor(private _http: Http) {
// Initialize Firebase
firebase.initializeApp(config.firebase);
firebase.auth().onAuthStateChanged((user: firebase.User) => {
this.user = user;
});
}
示例9: constructor
constructor() {
var config = {
apiKey: "AIzaSyD719Dp49in9cb6WvWp9jCAr9a67Y89r2U",
authDomain: "babylon-961af.firebaseapp.com",
databaseURL: "https://babylon-961af.firebaseio.com",
storageBucket: "babylon-961af.appspot.com",
};
firebase.initializeApp(config);
}
示例10: newFirebaseClient
function newFirebaseClient(port: number) {
const name = `test-firebase-client-${sequentialConnectionId++}`;
const url = `ws://localhost:${port}`;
const config = {
databaseURL: url,
};
const app = firebase.initializeApp(config, name);
apps.push(app);
return app.database().ref();
}