當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。