|
1 | 1 | import firebase from "firebase/app";
|
2 | 2 | import "firebase/storage";
|
3 | 3 |
|
| 4 | +function initialize() { |
| 5 | + // [START storage_initialize] |
| 6 | + // Set the configuration for your app |
| 7 | + // TODO: Replace with your app's config object |
| 8 | + var firebaseConfig = { |
| 9 | + apiKey: '<your-api-key>', |
| 10 | + authDomain: '<your-auth-domain>', |
| 11 | + databaseURL: '<your-database-url>', |
| 12 | + storageBucket: '<your-storage-bucket-url>' |
| 13 | + }; |
| 14 | + firebase.initializeApp(firebaseConfig); |
| 15 | + |
| 16 | + // Get a reference to the storage service, which is used to create references in your storage bucket |
| 17 | + var storage = firebase.storage(); |
| 18 | + // [END storage_initialize] |
| 19 | +} |
| 20 | + |
| 21 | +function multipleBuckets() { |
| 22 | + // [START storage_multiple_buckets] |
| 23 | + // Get a non-default Storage bucket |
| 24 | + var storage = firebase.app().storage("gs://my-custom-bucket"); |
| 25 | + // [END storage_multiple_buckets] |
| 26 | +} |
| 27 | + |
| 28 | +function storageCustomApp() { |
| 29 | + const customApp = firebase.initializeApp({ |
| 30 | + // ... custom stuff |
| 31 | + }); |
| 32 | + |
| 33 | + // [START storage_custom_app] |
| 34 | + // Get the default bucket from a custom firebase.app.App |
| 35 | + var storage = customApp.storage(); |
| 36 | + |
| 37 | + // Get a non-default bucket from a custom firebase.app.App |
| 38 | + var storage = customApp.storage("gs://my-custom-bucket"); |
| 39 | + // [END storage_custom_app] |
| 40 | +} |
| 41 | + |
4 | 42 | /**
|
5 | 43 | * @param {File} file
|
6 | 44 | */
|
|
0 commit comments