File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
Node/quickstarts/callable-functions-streaming/website Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change 2929 connectFunctionsEmulator ( functions , "127.0.0.1" , 5001 ) ;
3030 const getForecast = httpsCallable ( functions , "getForecast" ) ;
3131
32- async function handleClick ( ) {
33- // reset result
34- clearUi ( ) ;
35-
36- const resp = await getForecast . stream ( {
37- locations : [
32+ const favoriteLocations = [
3833 // Google HQ
3934 { latitude : 37.4220199895279 , longitude : - 122.08531347325561 } ,
4035 // Yosemite Valley
4136 { latitude : 37.745192257741984 , longitude : - 119.5945133017153 } ,
4237 // Old Faithful
4338 { latitude : 44.46037818049411 , longitude : - 110.82802255265777 } ,
44- ] ,
39+ ]
40+
41+ async function handleClick ( ) {
42+ // reset result
43+ clearUi ( ) ;
44+
45+ const resp = await getForecast . stream ( {
46+ locations : favoriteLocations ,
4547 } ) ;
4648
47- // add each new chunk to the output
49+ // loop through the `stream` async iterable
4850 for await ( const forecastData of resp . stream ) {
4951 updateUi ( forecastData ) ;
5052 }
You can’t perform that action at this time.
0 commit comments