Movatterモバイル変換


[0]ホーム

URL:


Use async/await - AWS SDK for JavaScript
DocumentationAWS SDK for JavaScriptDeveloper Guide for SDK Version 3

TheAWS SDK for JavaScript V3 API Reference Guide describes in detail all the API operations for the AWS SDK for JavaScript version 3 (V3).

Use async/await

Rather than using promises, you should consider using async/await. Async functions are simpler and take less boilerplate than using promises. Await can only be used in an async function to asynchronously wait for a value.

The following example uses async/await to list all of your Amazon DynamoDB tables in us-west-2.

import{ DynamoDBClient, ListTablesCommand} from "@aws-sdk/client-dynamodb";(async function (){ const dbClient = new DynamoDBClient({ region: "us-west-2" }); const command = new ListTablesCommand({}); try{ const results = await dbClient.send(command); console.log(results.TableNames.join('\n')); } catch (err){ console.error(err) }})();

Not all browsers support async/await. SeeAsync functions for a list of browsers with async/await support.

Manage asynchronous calls
Use promises

[8]
ページ先頭

©2009-2025 Movatter.jp