MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / listCallback

Function listCallback

compute/listImagesByPage.js:50–66  ·  view source on GitHub ↗
(err, resources, nextPageRequest, response)

Source from the content-addressed store, hash-verified

48 // iteration over paginated results from the API. Each time you want to access the
49 // next page, the library retrieves that page from the API.
50 const listCallback = (err, resources, nextPageRequest, response) => {
51 if (err) {
52 console.error(err);
53 return;
54 }
55
56 console.log(`Page ${pageNum}:`);
57 pageNum += 1;
58
59 for (let i = 0; i < resources.length; i++) {
60 console.log(resources[i].name);
61 }
62
63 if (response.nextPageToken) {
64 imagesClient.list(nextPageRequest, options, listCallback);
65 }
66 };
67
68 imagesClient.list(listRequest, options, listCallback);
69 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected