Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(aws-amplify): add inline docs for Amplify configure and getConfig methods #12487

Merged
merged 2 commits into from
Dec 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading