@aws-amplify/core
Version:
Core category of aws-amplify
22 lines (19 loc) • 804 B
JavaScript
import { InMemoryStorage } from './InMemoryStorage.mjs';
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
/**
* @internal
* @returns Either a reference to window.localStorage or an in-memory storage as fallback
*/
const getLocalStorageWithFallback = () => typeof window !== 'undefined' && window.localStorage
? window.localStorage
: new InMemoryStorage();
/**
* @internal
* @returns Either a reference to window.sessionStorage or an in-memory storage as fallback
*/
const getSessionStorageWithFallback = () => typeof window !== 'undefined' && window.sessionStorage
? window.sessionStorage
: new InMemoryStorage();
export { getLocalStorageWithFallback, getSessionStorageWithFallback };
//# sourceMappingURL=utils.mjs.map