Skip to content

Commit 38282bb

Browse files
HuiSFcshfang
andauthored
chore(aws-amplify): add inline docs for Amplify configure and getConfig methods (#12487)
* chore(aws-amplify): add inline docs for Amplify configure and getConfig methods * Apply suggestions from code review Co-authored-by: Chris F <[email protected]> --------- Co-authored-by: Chris F <[email protected]>
1 parent ef20ad8 commit 38282bb

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

packages/aws-amplify/src/initSingleton.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,22 @@ import {
1717
} from './auth/cognito';
1818

1919
export const DefaultAmplify = {
20+
/**
21+
* Configures Amplify with the {@link resourceConfig} and {@link libraryOptions}.
22+
*
23+
* @param resourceConfig The {@link ResourcesConfig} object that is typically imported from the
24+
* `amplifyconfiguration.json` file. It can also be an object literal created inline when calling `Amplify.configure`.
25+
* @param libraryOptions The {@link LibraryOptions} additional options for the library.
26+
*
27+
* @example
28+
* import config from './amplifyconfiguration.json';
29+
*
30+
* Amplify.configure(config);
31+
*/
2032
configure(
2133
resourceConfig: ResourcesConfig | LegacyConfig,
2234
libraryOptions?: LibraryOptions
23-
) {
35+
): void {
2436
let resolvedResourceConfig: ResourcesConfig;
2537

2638
if (Object.keys(resourceConfig).some(key => key.startsWith('aws_'))) {
@@ -81,6 +93,12 @@ export const DefaultAmplify = {
8193
// configured libraryOptions.
8294
Amplify.configure(resolvedResourceConfig);
8395
},
96+
/**
97+
* Returns the {@link ResourcesConfig} object passed in as the `resourceConfig` parameter when calling
98+
* `Amplify.configure`.
99+
*
100+
* @returns An {@link ResourcesConfig} object.
101+
*/
84102
getConfig(): ResourcesConfig {
85103
return Amplify.getConfig();
86104
},

0 commit comments

Comments
 (0)