当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript firebase.initializeApp函数代码示例

本文整理汇总了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();
    });
  }
开发者ID:khavq,项目名称:ion2-bangbang,代码行数:31,代码来源:app.ts

示例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();
    });

  }
开发者ID:akanbitoluwase,项目名称:javebratt,代码行数:29,代码来源:app.ts

示例3: ngOnInit

ngOnInit()
{
    firebase.initializeApp({
       apiKey: "AIzaSyCl0HAbu80XdmOlsaGLgh1g9sLJZn33uKc",
       authDomain: "comprasapp-4496f.firebaseapp.com"
    });
}
开发者ID:Corovino,项目名称:appCompras,代码行数:7,代码来源:app.component.ts

示例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');
      }
    });
开发者ID:magnetapp,项目名称:call-service,代码行数:30,代码来源:FirebaseService.ts

示例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();

  }  
开发者ID:gdessard,项目名称:handballStats,代码行数:30,代码来源:app.ts

示例6: init

export function init(options: FirebaseOptions) {
  const fb = Firebase.initializeApp(options);

  _database = fb.database();
  _auth = fb.auth();
  _storage = fb.storage();
}
开发者ID:peterellisjones,项目名称:firebase-3-react,代码行数:7,代码来源:init.ts

示例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;
          }
        });
    });
开发者ID:NiNiiWs,项目名称:Ionic2-Firebase3-Email-Auth,代码行数:25,代码来源:app.ts

示例8: constructor

  constructor(private _http: Http) {
    // Initialize Firebase
    firebase.initializeApp(config.firebase);

    firebase.auth().onAuthStateChanged((user: firebase.User) => {
      this.user = user;
    });
  }
开发者ID:HemanthKona,项目名称:material2,代码行数:8,代码来源:firebase.service.ts

示例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);
 }
开发者ID:jpmsegurado,项目名称:babylon,代码行数:9,代码来源:firebase.ts

示例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();
	}
开发者ID:urish,项目名称:firebase-server,代码行数:10,代码来源:server.spec.ts


注:本文中的firebase.initializeApp函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。