Example #1
0
const __set = (key, value) => {

	if (SESS_STORAGE)
	{
		SESS_STORAGE.setItem(key, value);
	}
	else if (WIN_STORAGE && window.JSON)
	{
		let data = WIN_STORAGE.name && '{' === WIN_STORAGE.name.toString().substr(0, 1) ? window.JSON.parse(WIN_STORAGE.name.toString()) : null;
		data = data || {};
		data[key] = value;

		WIN_STORAGE.name = window.JSON.stringify(data);
	}
};
Example #2
0
const __get = (key) => {

	let result = null;
	if (SESS_STORAGE)
	{
		result = SESS_STORAGE.getItem(key) || null;
	}
	else if (WIN_STORAGE && window.JSON)
	{
		const data = WIN_STORAGE.name && '{' === WIN_STORAGE.name.toString().substr(0, 1) ? window.JSON.parse(WIN_STORAGE.name.toString()) : null;
		result = data ? (data[key] || null) : null;
	}

	return result;
};