src/plugins/easycurrency/Session.js
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);
}
}