Açıklama Yok
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

init.js 1.7KB

123456789101112131415161718192021222324252627282930313233343536
  1. if (typeof firebase === 'undefined') throw new Error('hosting/init-error: Firebase SDK not detected. You must include it before /__/firebase/init.js');
  2. /*--CONFIG--*/
  3. if (firebaseConfig) {
  4. firebase.initializeApp(firebaseConfig);
  5. /*--EMULATORS--*/
  6. if (firebaseEmulators) {
  7. console.log("Automatically connecting Firebase SDKs to running emulators:");
  8. Object.keys(firebaseEmulators).forEach(function (key) {
  9. console.log('\t' + key + ': http://' + firebaseEmulators[key].hostAndPort);
  10. });
  11. if (firebaseEmulators.database && typeof firebase.database === 'function') {
  12. firebase.database().useEmulator(firebaseEmulators.database.host, firebaseEmulators.database.port);
  13. }
  14. if (firebaseEmulators.firestore && typeof firebase.firestore === 'function') {
  15. firebase.firestore().useEmulator(firebaseEmulators.firestore.host, firebaseEmulators.firestore.port);
  16. }
  17. if (firebaseEmulators.functions && typeof firebase.functions === 'function') {
  18. firebase.functions().useEmulator(firebaseEmulators.functions.host, firebaseEmulators.functions.port);
  19. }
  20. if (firebaseEmulators.auth && typeof firebase.auth === 'function') {
  21. // TODO: Consider using location.protocol + '//' instead (may help HTTPS).
  22. firebase.auth().useEmulator('http://' + firebaseEmulators.auth.hostAndPort);
  23. }
  24. if (firebaseEmulators.storage && typeof firebase.storage === 'function') {
  25. firebase.storage().useEmulator(firebaseEmulators.storage.host, firebaseEmulators.storage.port);
  26. }
  27. } else {
  28. console.log("To automatically connect the Firebase SDKs to running emulators, replace '/__/firebase/init.js' with '/__/firebase/init.js?useEmulator=true' in your index.html");
  29. }
  30. }