Skip to content

Commit

Permalink
chore(aws-amplify): add inline docs for Amplify configure and getConf…
Browse files Browse the repository at this point in the history
…ig 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]>
  • Loading branch information
HuiSF and cshfang authored Dec 1, 2023
1 parent ef20ad8 commit 38282bb
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion packages/aws-amplify/src/initSingleton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,22 @@ import {
} from './auth/cognito';

export const DefaultAmplify = {
/**
* Configures Amplify with the {@link resourceConfig} and {@link libraryOptions}.
*
* @param resourceConfig The {@link ResourcesConfig} object that is typically imported from the
* `amplifyconfiguration.json` file. It can also be an object literal created inline when calling `Amplify.configure`.
* @param libraryOptions The {@link LibraryOptions} additional options for the library.
*
* @example
* import config from './amplifyconfiguration.json';
*
* Amplify.configure(config);
*/
configure(
resourceConfig: ResourcesConfig | LegacyConfig,
libraryOptions?: LibraryOptions
) {
): void {
let resolvedResourceConfig: ResourcesConfig;

if (Object.keys(resourceConfig).some(key => key.startsWith('aws_'))) {
Expand Down Expand Up @@ -81,6 +93,12 @@ export const DefaultAmplify = {
// configured libraryOptions.
Amplify.configure(resolvedResourceConfig);
},
/**
* Returns the {@link ResourcesConfig} object passed in as the `resourceConfig` parameter when calling
* `Amplify.configure`.
*
* @returns An {@link ResourcesConfig} object.
*/
getConfig(): ResourcesConfig {
return Amplify.getConfig();
},
Expand Down

0 comments on commit 38282bb

Please sign in to comment.