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
  • Loading branch information
HuiSF committed Nov 2, 2023
1 parent 1aa0c2b commit d9584e8
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 by calling `Amplify.configure`.
* @param libraryOptions The {@link LibraryOptions} object contains configuration for the library of each category.
*
* @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 @@ -63,6 +75,12 @@ export const DefaultAmplify = {
Amplify.configure(resolvedResourceConfig, libraryOptions);
}
},
/**
* Returns the {@link ResourcesConfig} object passed in as the `libraryOptions` parameter of calling
* `Amplify.configure`.
*
* @returns An {@link ResourcesConfig} object.
*/
getConfig(): ResourcesConfig {
return Amplify.getConfig();
},
Expand Down

0 comments on commit d9584e8

Please sign in to comment.