UNPKG

@eastsideco/escshopify

Version:

WIP JS library for Shopify, containing a variety of useful functionality.

27 lines (21 loc) 712 B
import localStorage from 'local-storage-fallback'; import utils from 'utils/general'; /** * Methods for persisting the state into the current session. */ export default class Session { /** * Retrieves the active currency from session. * @return {undefined|String} */ getCurrency() { return localStorage.getItem(utils.safeStorageKey('escshopify', 'EasyCurrency::Session:currency')); } /** * Records the active currency in the session. * @param {null|String} value - The currency to record, or null to clear. */ saveCurrency(value) { localStorage.setItem(utils.safeStorageKey('escshopify', 'EasyCurrency::Session:currency'), value); } }