Skip to content

Commit

Permalink
fix(core): remove used symbol and remove usage of Symbol.for
Browse files Browse the repository at this point in the history
  • Loading branch information
HuiSF committed Nov 3, 2023
1 parent 3ae78c7 commit 0960fdd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 17 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/Hub/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import {
} from './types';

export const AMPLIFY_SYMBOL = (
typeof Symbol !== 'undefined' && typeof Symbol.for === 'function'
? Symbol.for('amplify_default')
typeof Symbol !== 'undefined'
? Symbol('amplify_default')
: '@@amplify_default'
) as Symbol;

Expand Down
11 changes: 0 additions & 11 deletions packages/core/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,6 @@
// Logging constants
export const AWS_CLOUDWATCH_CATEGORY = 'Logging';

/**
* This Symbol is used to reference an internal-only PubSub provider that
* is used for AppSync/GraphQL subscriptions in the API category.
*/
const hasSymbol =
typeof Symbol !== 'undefined' && typeof Symbol.for === 'function';

export const INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER = hasSymbol
? Symbol.for('INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER')
: '@@INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER';

export const USER_AGENT_HEADER = 'x-amz-user-agent';

// Error exception code constants
Expand Down
5 changes: 1 addition & 4 deletions packages/core/src/libraryUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@ export {
export { BackgroundProcessManager } from './BackgroundProcessManager';
export { Mutex } from './Mutex';
export { Reachability } from './Reachability';
export {
INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER,
USER_AGENT_HEADER,
} from './constants';
export { USER_AGENT_HEADER } from './constants';
export { fetchAuthSession } from './singleton/apis/internal/fetchAuthSession';
export { AMPLIFY_SYMBOL } from './Hub';
export { base64Decoder, base64Encoder } from './utils/convert';
Expand Down

0 comments on commit 0960fdd

Please sign in to comment.