src/entry/micro-storage.js
function storage ( name, value ) {
        if (arguments.length == 0) {
            return;
        }
        if (arguments.length == 1) {
            let result = JSON.parse(localStorage.getItem(`${ namespace }.${ name }`));
            return result ? result.$ : result;
        }
        localStorage.setItem(`${ namespace }.${ name }`, JSON.stringify({ $ : value }));
        list[namespace][name] = '';
        localStorage.setItem(packageName, JSON.stringify(list));
        return value;
    }
function storage ( name, value ) {
        if (arguments.length == 0) {
            return;
        }
        if (arguments.length == 1) {
            let result = JSON.parse(localStorage.getItem(`${ namespace }.${ name }`));
            return result ? result.$ : result;
        }
        localStorage.setItem(`${ namespace }.${ name }`, JSON.stringify({ $ : value }));
        list[namespace][name] = '';
        localStorage.setItem(packageName, JSON.stringify(list));
        return value;
    }
function storage ( name , value ) { if ( arguments . length == 0 ) { return ; } if ( arguments . length == 1 ) { let result = JSON . parse ( localStorage . getItem ( ` ${ namespace } ${ name } ` ) ) ; return result ? result . $ : result ; } localStorage . setItem ( ` ${ namespace } ${ name } ` , JSON . stringify ( { $ : value } ) ) ; list [ namespace ] [ name ] = '' ; localStorage . setItem ( packageName , JSON . stringify ( list ) ) ; return value ; }
Get or set value from storage
@param {String} name key
@param {AnyType} value value
@return {AnyType} value
Get or set value from storage