src/pages/js/index.js
/**
 * Check if storage is supported and available
 * @param {Storage} type Storage type
 * @returns Storage availability
 */
Check if storage is supported and available
@param {Storage} type Storage type
@returns Storage availability
Check if storage is supported and available @param { Storage } type Storage type @returns Storage availability
function storageAvailable(type)
{
    let storage;
    try
    {
        storage = window[type];
        let x = "__storage_test__";
        storage.setItem(x, x);
        storage.removeItem(x);
        return true;
    }
    catch (e)
    {
        return e instanceof DOMException && (
            e.code === 22 ||
            e.code === 1014 ||
            e.name === "QuotaExceededError" ||
            e.name === "NS_ERROR_DOM_QUOTA_REACHED"
        ) && (storage && storage.length !== 0);
    }
}
function storageAvailable ( type ) { let storage ; try { storage = window [ type ] ; let x = "__storage_test__" ; storage . setItem ( x , x ) ; storage . removeItem ( x ) ; return true ; } catch ( e ) { return e instanceof DOMException && ( e . code === 22 || e . code === 1014 || e . name === "QuotaExceededError" || e . name === "NS_ERROR_DOM_QUOTA_REACHED" ) && ( storage && storage . length !== 0 ) ; } }
Check if storage is supported and available
 @param {Storage} type Storage type
 @returns Storage availability
Check if storage is supported and available @param { Storage } type Storage type @returns Storage availability