Skip to content

Commit 254bfb7

Browse files
committed
rearrange
1 parent c93debd commit 254bfb7

File tree

1 file changed

+10
-8
lines changed
  • Node/quickstarts/callable-functions-streaming/website

1 file changed

+10
-8
lines changed

Node/quickstarts/callable-functions-streaming/website/index.html

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,24 @@
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
}

0 commit comments

Comments
 (0)