你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Azure Core Paging client library for JavaScript - 版本 1.7.0

该库为分页异步迭代子提供了核心类型。

入门

Installation

此包主要用于生成的代码中,不应由最终用户直接使用。

重要概念

你可以访问我们的 架构概述,了解该仓库代码的工作原理。

示例

使用以下类型的建筑示例:

import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";

function listSecrets(
  options: ListSecretsOptions = {},
): PagedAsyncIterableIterator<SecretAttributes> {
  const iter = listSecretsAll(options);
  return {
    async next() {
      return iter.next();
    },
    [Symbol.asyncIterator]() {
      return this;
    },
    byPage: (settings: PageSettings = {}) => listSecretsPage(settings, options),
  };
}

for await (const page of listSecrets().byPage({ maxPageSize: 2 })) {
  for (const secret of page) {
    console.log("secret: ", secret);
  }
}

并使用以下类型:

  for await (let page of client.listSecrets().byPage({ maxPageSize: 2 })) {
    for (const secret of page) {
      console.log("secret: ", secret);
    }
  }

后续步骤

在处理异步可迭代器时,试用这个软件包并提供反馈!

故障排除

请在 https://github.com/Azure/azure-sdk-for-js/issues

Contributing

若要参与此库,请阅读 贡献指南 了解有关如何生成和测试代码的详细信息。