File tree 3 files changed +45
-0
lines changed
snippets/storage-next/emulator-suite
3 files changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ // This snippet file was generated by processing the source file:
2
+ // ./storage-next/emulator-suite.js
3
+ //
4
+ // To update the snippets in this file, edit the source and then run
5
+ // 'npm run snippets'.
6
+
7
+ // [START storage_emulator_connect_modular]
8
+ import { getStorage , connectStorageEmulator } from "firebase/storage" ;
9
+
10
+ const storage = getStorage ( ) ;
11
+ if ( location . hostname === "localhost" ) {
12
+ // Point to the Storage emulator running on localhost.
13
+ connectStorageEmulator ( storage , "localhost" , 9199 ) ;
14
+ }
15
+ // [END storage_emulator_connect_modular]
Original file line number Diff line number Diff line change
1
+ // [SNIPPET_REGISTRY disabled]
2
+ // [SNIPPETS_SEPARATION enabled]
3
+
4
+ function onDocumentReady ( ) {
5
+ // [START storage_emulator_connect]
6
+ const { getStorage, connectStorageEmulator } = require ( "firebase/storage" ) ;
7
+
8
+ const storage = getStorage ( ) ;
9
+ if ( location . hostname === "localhost" ) {
10
+ // Point to the Storage emulator running on localhost.
11
+ connectStorageEmulator ( storage , "localhost" , 9199 ) ;
12
+ }
13
+ // [END storage_emulator_connect]
14
+ }
Original file line number Diff line number Diff line change
1
+ // These samples are intended for Web so this import would normally be
2
+ // done in HTML however using modules here is more convenient for
3
+ // ensuring sample correctness offline.
4
+ import firebase from "firebase/app" ;
5
+ import "firebase/storage" ;
6
+
7
+ function onDocumentReady ( ) {
8
+ // [START storage_emulator_connect]
9
+ var storage = firebase . storage ( ) ;
10
+ if ( location . hostname === "localhost" ) {
11
+ // Point to the Storage emulator running on localhost.
12
+ storage . useEmulator ( "localhost" , 9199 ) ;
13
+ }
14
+ // [END storage_emulator_connect]
15
+ }
16
+
You can’t perform that action at this time.
0 commit comments