@azrico/global 1.3.79 → 1.3.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
+ import { gstorage, gbasket } from "./packages/storage";
2
+ export { gstorage, gbasket };
1
3
  export * as gglobal from "./packages/core";
2
4
  export * as gonce from "./packages/once";
3
5
  export * as gcache from "./packages/cache";
4
- export * as gstorage from "./packages/storage";
5
6
  export * as gtranslate from "./packages/translation";
6
7
  export { gfilter, gfunc, gholder, gview } from "./packages/hooks";
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var _gglobal=_interopRequireWildcard(require("./packages/core"));var _gonce=_interopRequireWildcard(require("./packages/once"));var _gcache=_interopRequireWildcard(require("./packages/cache"));var _gstorage=_interopRequireWildcard(require("./packages/storage"));var _gtranslate=_interopRequireWildcard(require("./packages/translation"));var _hooks=require("./packages/hooks");function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.gcache=void 0,Object.defineProperty(exports,"gfilter",{enumerable:!0,get:function get(){return _hooks.gfilter}}),Object.defineProperty(exports,"gfunc",{enumerable:!0,get:function get(){return _hooks.gfunc}}),exports.gglobal=void 0,Object.defineProperty(exports,"gholder",{enumerable:!0,get:function get(){return _hooks.gholder}}),exports.gtranslate=exports.gstorage=exports.gonce=void 0,Object.defineProperty(exports,"gview",{enumerable:!0,get:function get(){return _hooks.gview}});exports.gglobal=_gglobal;exports.gonce=_gonce;exports.gcache=_gcache;exports.gstorage=_gstorage;exports.gtranslate=_gtranslate;function _getRequireWildcardCache(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(_getRequireWildcardCache=function(a){return a?c:b})(a)}function _interopRequireWildcard(b,c){if(!c&&b&&b.__esModule)return b;if(null===b||"object"!=_typeof(b)&&"function"!=typeof b)return{default:b};var d=_getRequireWildcardCache(c);if(d&&d.has(b))return d.get(b);var e={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in b)if("default"!=a&&{}.hasOwnProperty.call(b,a)){var g=f?Object.getOwnPropertyDescriptor(b,a):null;g&&(g.get||g.set)?Object.defineProperty(e,a,g):e[a]=b[a]}return e["default"]=b,d&&d.set(b,e),e}
1
+ "use strict";var _gonce=_interopRequireWildcard(require("./packages/once"));var _gcache=_interopRequireWildcard(require("./packages/cache"));var _gtranslate=_interopRequireWildcard(require("./packages/translation"));var _hooks=require("./packages/hooks");function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"gbasket",{enumerable:!0,get:function get(){return _storage.gbasket}}),exports.gcache=void 0,Object.defineProperty(exports,"gfilter",{enumerable:!0,get:function get(){return _hooks.gfilter}}),Object.defineProperty(exports,"gfunc",{enumerable:!0,get:function get(){return _hooks.gfunc}}),exports.gglobal=void 0,Object.defineProperty(exports,"gholder",{enumerable:!0,get:function get(){return _hooks.gholder}}),exports.gonce=void 0,Object.defineProperty(exports,"gstorage",{enumerable:!0,get:function get(){return _storage.gstorage}}),exports.gtranslate=void 0,Object.defineProperty(exports,"gview",{enumerable:!0,get:function get(){return _hooks.gview}});var _storage=require("./packages/storage"),_gglobal=_interopRequireWildcard(require("./packages/core"));exports.gglobal=_gglobal;exports.gonce=_gonce;exports.gcache=_gcache;exports.gtranslate=_gtranslate;function _getRequireWildcardCache(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(_getRequireWildcardCache=function(a){return a?c:b})(a)}function _interopRequireWildcard(b,c){if(!c&&b&&b.__esModule)return b;if(null===b||"object"!=_typeof(b)&&"function"!=typeof b)return{default:b};var d=_getRequireWildcardCache(c);if(d&&d.has(b))return d.get(b);var e={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in b)if("default"!=a&&{}.hasOwnProperty.call(b,a)){var g=f?Object.getOwnPropertyDescriptor(b,a):null;g&&(g.get||g.set)?Object.defineProperty(e,a,g):e[a]=b[a]}return e["default"]=b,d&&d.set(b,e),e}
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.delete_session_cache=delete_session_cache,exports.delete_temp_cache=delete_temp_cache,exports.get_session_cache=get_session_cache,exports.get_temp_cache=get_temp_cache,exports.get_temp_cache_sync=get_temp_cache_sync,exports.set_session_cache=set_session_cache,exports.set_temp_cache=set_temp_cache;var _core=_interopRequireDefault(require("../core")),_index=require("../../index");function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */function b(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function f(b,d,e,f){var g=d&&d.prototype instanceof k?d:k,h=Object.create(g.prototype),a=new B(f||[]);return E(h,"_invoke",{value:w(b,e,a)}),h}function j(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function k(){}function l(){}function m(){}function q(a){["next","throw","return"].forEach(function(c){b(a,c,function(a){return this._invoke(c,a)})})}function s(b,d){function c(e,f,g,i){var a=j(b[e],b,f);if("throw"!==a.type){var k=a.arg,l=k.value;return l&&"object"==_typeof(l)&&t.call(l,"__await")?d.resolve(l.__await).then(function(a){c("next",a,g,i)},function(a){c("throw",a,g,i)}):d.resolve(l).then(function(a){k.value=a,g(k)},function(a){return c("throw",a,g,i)})}i(a.arg)}var e;E(this,"_invoke",{value:function value(a,b){function f(){return new d(function(d,e){c(a,b,d,e)})}return e=e?e.then(f,f):f()}})}function w(a,b,d){var e="suspendedStart";return function(f,g){if(e==="executing")throw Error("Generator is already running");if("completed"===e){if("throw"===f)throw g;return{value:D,done:!0}}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var i=x(h,d);if(i){if(i===G)continue;return i}}if("next"===d.method)d.sent=d._sent=d.arg;else if("throw"===d.method){if("suspendedStart"===e)throw e="completed",d.arg;d.dispatchException(d.arg)}else"return"===d.method&&d.abrupt("return",d.arg);e="executing";var k=j(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===G)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}function x(b,c){var d=c.method,e=b.iterator[d];if(e===D)return c.delegate=null,"throw"===d&&b.iterator["return"]&&(c.method="return",c.arg=D,x(b,c),"throw"===c.method)||"return"!==d&&(c.method="throw",c.arg=new TypeError("The iterator does not provide a '"+d+"' method")),G;var f=j(e,b.iterator,c.arg);if("throw"===f.type)return c.method="throw",c.arg=f.arg,c.delegate=null,G;var g=f.arg;return g?g.done?(c[b.resultName]=g.value,c.next=b.nextLoc,"return"!==c.method&&(c.method="next",c.arg=D),c.delegate=null,G):g:(c.method="throw",c.arg=new TypeError("iterator result is not an object"),c.delegate=null,G)}function z(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function A(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function B(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(z,this),this.reset(!0)}function C(a){if(a||""===a){var b=a[F];if(b)return b.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var c=-1,d=function b(){for(;++c<a.length;)if(t.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=D,b.done=!0,b};return d.next=d}}throw new TypeError(_typeof(a)+" is not iterable")}_regeneratorRuntime=function(){return h};var D,h={},e=Object.prototype,t=e.hasOwnProperty,E=Object.defineProperty||function(a,b,c){a[b]=c.value},n="function"==typeof Symbol?Symbol:{},F=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",c=n.toStringTag||"@@toStringTag";try{b({},"")}catch(a){b=function(a,b,c){return a[b]=c}}h.wrap=f;var G={},i={};b(i,F,function(){return this});var o=Object.getPrototypeOf,d=o&&o(o(C([])));d&&d!==e&&t.call(d,F)&&(i=d);var r=m.prototype=k.prototype=Object.create(i);return l.prototype=m,E(r,"constructor",{value:m,configurable:!0}),E(m,"constructor",{value:l,configurable:!0}),l.displayName=b(m,c,"GeneratorFunction"),h.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===l||"GeneratorFunction"===(b.displayName||b.name))},h.mark=function(a){return Object.setPrototypeOf?Object.setPrototypeOf(a,m):(a.__proto__=m,b(a,c,"GeneratorFunction")),a.prototype=Object.create(r),a},h.awrap=function(a){return{__await:a}},q(s.prototype),b(s.prototype,a,function(){return this}),h.AsyncIterator=s,h.async=function(b,c,d,e,g){void 0===g&&(g=Promise);var j=new s(f(b,c,d,e),g);return h.isGeneratorFunction(c)?j:j.next().then(function(a){return a.done?a.value:j.next()})},q(r),b(r,c,"Generator"),b(r,F,function(){return this}),b(r,"toString",function(){return"[object Generator]"}),h.keys=function(a){var b=Object(a),c=[];for(var d in b)c.push(d);return c.reverse(),function a(){for(;c.length;){var d=c.pop();if(d in b)return a.value=d,a.done=!1,a}return a.done=!0,a}},h.values=C,B.prototype={constructor:B,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=D,this.done=!1,this.delegate=null,this.method="next",this.arg=D,this.tryEntries.forEach(A),!a)for(var b in this)"t"===b.charAt(0)&&t.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=D)},stop:function stop(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function dispatchException(b){function d(a,c){return h.type="throw",h.arg=b,e.next=a,c&&(e.method="next",e.arg=D),!!c}if(this.done)throw b;for(var e=this,f=this.tryEntries.length-1;0<=f;--f){var g=this.tryEntries[f],h=g.completion;if("root"===g.tryLoc)return d("end");if(g.tryLoc<=this.prev){var j=t.call(g,"catchLoc"),k=t.call(g,"finallyLoc");if(j&&k){if(this.prev<g.catchLoc)return d(g.catchLoc,!0);if(this.prev<g.finallyLoc)return d(g.finallyLoc)}else if(!j){if(!k)throw Error("try statement without catch or finally");if(this.prev<g.finallyLoc)return d(g.finallyLoc)}else if(this.prev<g.catchLoc)return d(g.catchLoc,!0)}}},abrupt:function abrupt(b,c){for(var d,e=this.tryEntries.length-1;0<=e;--e)if(d=this.tryEntries[e],d.tryLoc<=this.prev&&t.call(d,"finallyLoc")&&this.prev<d.finallyLoc){var f=d;break}f&&("break"===b||"continue"===b)&&f.tryLoc<=c&&c<=f.finallyLoc&&(f=null);var g=f?f.completion:{};return g.type=b,g.arg=c,f?(this.method="next",this.next=f.finallyLoc,G):this.complete(g)},complete:function complete(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),G},finish:function finish(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.finallyLoc===a)return this.complete(b.completion,b.afterLoc),A(b),G},catch:function _catch(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.tryLoc===a){var d=b.completion;if("throw"===d.type){var f=d.arg;A(b)}return f}throw Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:C(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=D),G}},h}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!=_typeof(a)||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var sname="cache",name_pending="pending_cache",GCache=/*#__PURE__*/function(){function a(){_classCallCheck(this,a)}return _createClass(a,null,[{key:"get_cache_sync",value:function get_cache_sync(a,b){var c="".concat(sname,"-").concat(_core["default"].fixKey(a)),d=_index.gstorage.get_var_sync(c);//check if cache exists
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.delete_session_cache=delete_session_cache,exports.delete_temp_cache=delete_temp_cache,exports.get_session_cache=get_session_cache,exports.get_temp_cache=get_temp_cache,exports.get_temp_cache_sync=get_temp_cache_sync,exports.set_session_cache=set_session_cache,exports.set_temp_cache=set_temp_cache;var _core=_interopRequireDefault(require("../core")),_index=require("../../index");function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */function b(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function f(b,d,e,f){var g=d&&d.prototype instanceof k?d:k,h=Object.create(g.prototype),a=new B(f||[]);return E(h,"_invoke",{value:w(b,e,a)}),h}function j(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function k(){}function l(){}function m(){}function q(a){["next","throw","return"].forEach(function(c){b(a,c,function(a){return this._invoke(c,a)})})}function s(b,d){function c(e,f,g,i){var a=j(b[e],b,f);if("throw"!==a.type){var k=a.arg,l=k.value;return l&&"object"==_typeof(l)&&t.call(l,"__await")?d.resolve(l.__await).then(function(a){c("next",a,g,i)},function(a){c("throw",a,g,i)}):d.resolve(l).then(function(a){k.value=a,g(k)},function(a){return c("throw",a,g,i)})}i(a.arg)}var e;E(this,"_invoke",{value:function value(a,b){function f(){return new d(function(d,e){c(a,b,d,e)})}return e=e?e.then(f,f):f()}})}function w(a,b,d){var e="suspendedStart";return function(f,g){if(e==="executing")throw Error("Generator is already running");if("completed"===e){if("throw"===f)throw g;return{value:D,done:!0}}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var i=x(h,d);if(i){if(i===G)continue;return i}}if("next"===d.method)d.sent=d._sent=d.arg;else if("throw"===d.method){if("suspendedStart"===e)throw e="completed",d.arg;d.dispatchException(d.arg)}else"return"===d.method&&d.abrupt("return",d.arg);e="executing";var k=j(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===G)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}function x(b,c){var d=c.method,e=b.iterator[d];if(e===D)return c.delegate=null,"throw"===d&&b.iterator["return"]&&(c.method="return",c.arg=D,x(b,c),"throw"===c.method)||"return"!==d&&(c.method="throw",c.arg=new TypeError("The iterator does not provide a '"+d+"' method")),G;var f=j(e,b.iterator,c.arg);if("throw"===f.type)return c.method="throw",c.arg=f.arg,c.delegate=null,G;var g=f.arg;return g?g.done?(c[b.resultName]=g.value,c.next=b.nextLoc,"return"!==c.method&&(c.method="next",c.arg=D),c.delegate=null,G):g:(c.method="throw",c.arg=new TypeError("iterator result is not an object"),c.delegate=null,G)}function z(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function A(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function B(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(z,this),this.reset(!0)}function C(a){if(a||""===a){var b=a[F];if(b)return b.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var c=-1,d=function b(){for(;++c<a.length;)if(t.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=D,b.done=!0,b};return d.next=d}}throw new TypeError(_typeof(a)+" is not iterable")}_regeneratorRuntime=function(){return h};var D,h={},e=Object.prototype,t=e.hasOwnProperty,E=Object.defineProperty||function(a,b,c){a[b]=c.value},n="function"==typeof Symbol?Symbol:{},F=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",c=n.toStringTag||"@@toStringTag";try{b({},"")}catch(a){b=function(a,b,c){return a[b]=c}}h.wrap=f;var G={},i={};b(i,F,function(){return this});var o=Object.getPrototypeOf,d=o&&o(o(C([])));d&&d!==e&&t.call(d,F)&&(i=d);var r=m.prototype=k.prototype=Object.create(i);return l.prototype=m,E(r,"constructor",{value:m,configurable:!0}),E(m,"constructor",{value:l,configurable:!0}),l.displayName=b(m,c,"GeneratorFunction"),h.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===l||"GeneratorFunction"===(b.displayName||b.name))},h.mark=function(a){return Object.setPrototypeOf?Object.setPrototypeOf(a,m):(a.__proto__=m,b(a,c,"GeneratorFunction")),a.prototype=Object.create(r),a},h.awrap=function(a){return{__await:a}},q(s.prototype),b(s.prototype,a,function(){return this}),h.AsyncIterator=s,h.async=function(b,c,d,e,g){void 0===g&&(g=Promise);var j=new s(f(b,c,d,e),g);return h.isGeneratorFunction(c)?j:j.next().then(function(a){return a.done?a.value:j.next()})},q(r),b(r,c,"Generator"),b(r,F,function(){return this}),b(r,"toString",function(){return"[object Generator]"}),h.keys=function(a){var b=Object(a),c=[];for(var d in b)c.push(d);return c.reverse(),function a(){for(;c.length;){var d=c.pop();if(d in b)return a.value=d,a.done=!1,a}return a.done=!0,a}},h.values=C,B.prototype={constructor:B,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=D,this.done=!1,this.delegate=null,this.method="next",this.arg=D,this.tryEntries.forEach(A),!a)for(var b in this)"t"===b.charAt(0)&&t.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=D)},stop:function stop(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function dispatchException(b){function d(a,c){return h.type="throw",h.arg=b,e.next=a,c&&(e.method="next",e.arg=D),!!c}if(this.done)throw b;for(var e=this,f=this.tryEntries.length-1;0<=f;--f){var g=this.tryEntries[f],h=g.completion;if("root"===g.tryLoc)return d("end");if(g.tryLoc<=this.prev){var j=t.call(g,"catchLoc"),k=t.call(g,"finallyLoc");if(j&&k){if(this.prev<g.catchLoc)return d(g.catchLoc,!0);if(this.prev<g.finallyLoc)return d(g.finallyLoc)}else if(!j){if(!k)throw Error("try statement without catch or finally");if(this.prev<g.finallyLoc)return d(g.finallyLoc)}else if(this.prev<g.catchLoc)return d(g.catchLoc,!0)}}},abrupt:function abrupt(b,c){for(var d,e=this.tryEntries.length-1;0<=e;--e)if(d=this.tryEntries[e],d.tryLoc<=this.prev&&t.call(d,"finallyLoc")&&this.prev<d.finallyLoc){var f=d;break}f&&("break"===b||"continue"===b)&&f.tryLoc<=c&&c<=f.finallyLoc&&(f=null);var g=f?f.completion:{};return g.type=b,g.arg=c,f?(this.method="next",this.next=f.finallyLoc,G):this.complete(g)},complete:function complete(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),G},finish:function finish(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.finallyLoc===a)return this.complete(b.completion,b.afterLoc),A(b),G},catch:function _catch(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.tryLoc===a){var d=b.completion;if("throw"===d.type){var f=d.arg;A(b)}return f}throw Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:C(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=D),G}},h}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!=_typeof(a)||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var sname="cache",name_pending="pending_cache",GCache=/*#__PURE__*/function(){function a(){_classCallCheck(this,a)}return _createClass(a,null,[{key:"get_cache_sync",value:function get_cache_sync(a,b){var c="".concat(sname,"-").concat(_core["default"].fixKey(a)),d=_index.gstorage.getSync(c);//check if cache exists
2
2
  if(d)return d;//cache did not exist. set the cache and return its value
3
- if(b){var e=b();return _index.gstorage.set_var_sync(c,e),e}}},{key:"get_cache",value:function(){function a(){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function c(a,b){var d,e,f,g,h=arguments;return _regeneratorRuntime().wrap(function i(c){for(;1;)switch(c.prev=c.next){case 0:if(d=!(2<h.length&&void 0!==h[2])||h[2],e="p-".concat(_core["default"].fixKey(a)),c.prev=2,f=_core["default"].Global_get(name_pending,e),null==f){c.next=8;break}return c.next=7,f;case 7:return c.abrupt("return",c.sent);case 8:return g=this._get_cache(a,b,d),_core["default"].Global_set(name_pending,e,g),c.next=12,g;case 12:return c.abrupt("return",c.sent);case 13:return c.prev=13,_core["default"].Global_set(name_pending,e,void 0),c.finish(13);case 16:case"end":return c.stop()}},c,this,[[2,,13,16]])}));return a}()},{key:"set_cache",value:function(){function b(a,b){return c.apply(this,arguments)}var c=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function d(b,c){var e,f,g,h,i,j=arguments;return _regeneratorRuntime().wrap(function k(d){for(;1;)switch(d.prev=d.next){case 0:return e=!(2<j.length&&void 0!==j[2])||j[2],f="undefined"!=typeof window,g="".concat(sname,"-").concat(_core["default"].fixKey(b)),h=e&&f,i=a.makeCacheObject(c),h&&(i=JSON.stringify(i)),d.next=8,_index.gstorage.set_var(g,i,{storage:!1,session:h,json:!1});case 8:return d.abrupt("return",c);case 9:case"end":return d.stop()}},d)}));return b}()},{key:"delete_cache",value:function(){function a(a){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){var c,d,e,f,g=arguments;return _regeneratorRuntime().wrap(function h(b){for(;1;)switch(b.prev=b.next){case 0:return c=!(1<g.length&&void 0!==g[1])||g[1],d="undefined"!=typeof window,e="".concat(sname,"-").concat(_core["default"].fixKey(a)),f=c&&d,b.next=6,_index.gstorage.set_var(e,void 0,{storage:!1,session:f,json:!1});case 6:return b.abrupt("return",!0);case 7:case"end":return b.stop()}},b)}));return a}()},{key:"_get_cache",value:function(){function b(a,b){return c.apply(this,arguments)}var c=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function d(b,c){var e,f,g,h,i,j,k=arguments;return _regeneratorRuntime().wrap(function l(d){for(;1;)switch(d.prev=d.next){case 0:return e=!(2<k.length&&void 0!==k[2])||k[2],f="".concat(sname,"-").concat(_core["default"].fixKey(b)),g="undefined"!=typeof window,h=e&&g,d.next=6,_index.gstorage.get_var(f,{storage:!1,session:h,json:!1});case 6:if(i=d.sent,null==i){d.next=9;break}return d.abrupt("return",a.parse_cacheValue(i));case 9:if(null!=c){d.next=11;break}return d.abrupt("return",void 0);case 11:if(j=c(),null==j||"object"!==_typeof(j)||"function"!=typeof j.then){d.next=20;break}return d.next=15,j;case 15:return i=d.sent,d.next=18,this.set_cache(b,i,e);case 18:d.next=23;break;case 20:return i=j,d.next=23,this.set_cache(b,i,e);case 23:return d.abrupt("return",i);case 24:case"end":return d.stop()}},d,this)}));return b}()},{key:"makeCacheObject",value:function makeCacheObject(a){return{type:_typeof(a),value:a}}},{key:"parse_cacheValue",value:function parse_cacheValue(b){if(null==b)return"";try{if("object"===_typeof(b))return b.value;var c="string"==typeof b?JSON.parse(b):b+"";return a.parse_cacheValue(c)}catch(a){console.error("failed to parse cache value:",b)}return b}}])}();/* -------------------------------------------------------------------------- */ /**
3
+ if(b){var e=b();return _index.gstorage.setSync(c,e),e}}},{key:"get_cache",value:function(){function a(){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function c(a,b){var d,e,f,g,h=arguments;return _regeneratorRuntime().wrap(function i(c){for(;1;)switch(c.prev=c.next){case 0:if(d=!(2<h.length&&void 0!==h[2])||h[2],e="p-".concat(_core["default"].fixKey(a)),c.prev=2,f=_core["default"].Global_get(name_pending,e),null==f){c.next=8;break}return c.next=7,f;case 7:return c.abrupt("return",c.sent);case 8:return g=this._get_cache(a,b,d),_core["default"].Global_set(name_pending,e,g),c.next=12,g;case 12:return c.abrupt("return",c.sent);case 13:return c.prev=13,_core["default"].Global_set(name_pending,e,void 0),c.finish(13);case 16:case"end":return c.stop()}},c,this,[[2,,13,16]])}));return a}()},{key:"set_cache",value:function(){function b(a,b){return c.apply(this,arguments)}var c=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function d(b,c){var e,f,g,h,i,j=arguments;return _regeneratorRuntime().wrap(function k(d){for(;1;)switch(d.prev=d.next){case 0:return e=!(2<j.length&&void 0!==j[2])||j[2],f="undefined"!=typeof window,g="".concat(sname,"-").concat(_core["default"].fixKey(b)),h=e&&f,i=a.makeCacheObject(c),h&&(i=JSON.stringify(i)),d.next=8,_index.gstorage.set(g,i,{storage:!1,session:h,json:!1});case 8:return d.abrupt("return",c);case 9:case"end":return d.stop()}},d)}));return b}()},{key:"delete_cache",value:function(){function a(a){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){var c,d,e,f,g=arguments;return _regeneratorRuntime().wrap(function h(b){for(;1;)switch(b.prev=b.next){case 0:return c=!(1<g.length&&void 0!==g[1])||g[1],d="undefined"!=typeof window,e="".concat(sname,"-").concat(_core["default"].fixKey(a)),f=c&&d,b.next=6,_index.gstorage.set(e,void 0,{storage:!1,session:f,json:!1});case 6:return b.abrupt("return",!0);case 7:case"end":return b.stop()}},b)}));return a}()},{key:"_get_cache",value:function(){function b(a,b){return c.apply(this,arguments)}var c=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function d(b,c){var e,f,g,h,i,j,k=arguments;return _regeneratorRuntime().wrap(function l(d){for(;1;)switch(d.prev=d.next){case 0:return e=!(2<k.length&&void 0!==k[2])||k[2],f="".concat(sname,"-").concat(_core["default"].fixKey(b)),g="undefined"!=typeof window,h=e&&g,d.next=6,_index.gstorage.get(f,{storage:!1,session:h,json:!1});case 6:if(i=d.sent,null==i){d.next=9;break}return d.abrupt("return",a.parse_cacheValue(i));case 9:if(null!=c){d.next=11;break}return d.abrupt("return",void 0);case 11:if(j=c(),null==j||"object"!==_typeof(j)||"function"!=typeof j.then){d.next=20;break}return d.next=15,j;case 15:return i=d.sent,d.next=18,this.set_cache(b,i,e);case 18:d.next=23;break;case 20:return i=j,d.next=23,this.set_cache(b,i,e);case 23:return d.abrupt("return",i);case 24:case"end":return d.stop()}},d,this)}));return b}()},{key:"makeCacheObject",value:function makeCacheObject(a){return{type:_typeof(a),value:a}}},{key:"parse_cacheValue",value:function parse_cacheValue(b){if(null==b)return"";try{if("object"===_typeof(b))return b.value;var c="string"==typeof b?JSON.parse(b):b+"";return a.parse_cacheValue(c)}catch(a){console.error("failed to parse cache value:",b)}return b}}])}();/* -------------------------------------------------------------------------- */ /**
4
4
  * set value of a cached key
5
5
  * @param key
6
6
  * @param value
@@ -3,18 +3,18 @@ type MaybeFilterAction = Function | string | number;
3
3
  * Adds a filter
4
4
  * @param key
5
5
  * @param action action of the filter. you can also use string and numbers
6
- * @param priority filters with lower priority are executed first
6
+ * @param order filters with lower order are executed first
7
7
  * @returns
8
8
  */
9
- export declare function add_filter(key: string, action: MaybeFilterAction, priority?: number): any;
9
+ export declare function add_filter(key: string, action: MaybeFilterAction, order?: number): any;
10
10
  /**
11
11
  * `clear_filter` on `key` and then uses `add_filter`
12
12
  * @param key
13
13
  * @param action action of the filter. you can also use string and numbers
14
- * @param priority filters with lower priority are executed first
14
+ * @param order filters with lower order are executed first
15
15
  * @returns
16
16
  */
17
- export declare function set_filter(key: string, action: MaybeFilterAction, priority?: number): any;
17
+ export declare function set_filter(key: string, action: MaybeFilterAction, order?: number): any;
18
18
  export declare function remove_filter(key: string, action: Function): any;
19
19
  export declare function clear_filter(key: string): any;
20
20
  export declare function clear_all_filters(): any;
@@ -36,8 +36,8 @@ export declare function apply_filter_sync(key: string, initialValue?: any): any;
36
36
  * Adds a filter until the current component unmounts
37
37
  * @param key
38
38
  * @param action
39
- * @param priority
39
+ * @param order
40
40
  * @returns
41
41
  */
42
- export declare function hold_add_filter(key: string, action: (...args: any[]) => any, priority?: number): any;
42
+ export declare function hold_add_filter(key: string, action: (...args: any[]) => any, order?: number): any;
43
43
  export {};
@@ -2,13 +2,13 @@
2
2
  * Adds a filter
3
3
  * @param key
4
4
  * @param action action of the filter. you can also use string and numbers
5
- * @param priority filters with lower priority are executed first
5
+ * @param order filters with lower order are executed first
6
6
  * @returns
7
- */function add_filter(a,b){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:10,d="function"==typeof b?b:function(){return b};return _core["default"].Global_add(lname_filter,a,{key:a,action:d,priority:c})}/**
7
+ */function add_filter(a,b){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:10,d="function"==typeof b?b:function(){return b};return _core["default"].Global_add(lname_filter,a,{key:a,action:d,order:c})}/**
8
8
  * `clear_filter` on `key` and then uses `add_filter`
9
9
  * @param key
10
10
  * @param action action of the filter. you can also use string and numbers
11
- * @param priority filters with lower priority are executed first
11
+ * @param order filters with lower order are executed first
12
12
  * @returns
13
13
  */function set_filter(a,b){var c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:10;return clear_filter(a),add_filter(a,b,c)}function remove_filter(a,b){return _core["default"].Global_remove(lname_filter,a,b)}function clear_filter(a){return _core["default"].Global_set(lname_filter,a,null)}function clear_all_filters(){return _core["default"].Global_set(lname_filter,!0,null)}/**
14
14
  * Apply a filter asynchronously
@@ -20,11 +20,11 @@
20
20
  * @param key
21
21
  * @param initialValue
22
22
  * @returns
23
- */function _apply_filter(){return _apply_filter=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){var c,d,e,f,g,h,i=arguments;return _regeneratorRuntime().wrap(function j(b){for(;1;)switch(b.prev=b.next){case 0:if(c=1<i.length&&void 0!==i[1]?i[1]:null,d=_core["default"].Global_get(lname_filter,a),Array.isArray(d)&&0!=d.length){b.next=4;break}return b.abrupt("return",c);case 4:d.sort(function(c,a){return c.priority>a.priority?1:-1}),e=c,f=0;case 7:if(!(f<d.length)){b.next=16;break}return g=d[f],b.next=11,g.action(e);case 11:h=b.sent,e=h;case 13:f++,b.next=7;break;case 16:return b.abrupt("return",e);case 17:case"end":return b.stop()}},b)})),_apply_filter.apply(this,arguments)}function apply_filter_sync(a){var b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:null,c=_core["default"].Global_get(lname_filter,a);if(!Array.isArray(c)||0==c.length)return b;c.sort(function(c,a){return c.priority>a.priority?1:-1});/* lower priority gets executed first */for(var d=b,e=0;e<c.length;e++){var f=c[e],g=f.action(d);//console.log("filtered ", previous_value, " --> ", new_value);
23
+ */function _apply_filter(){return _apply_filter=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){var c,d,e,f,g,h,i=arguments;return _regeneratorRuntime().wrap(function j(b){for(;1;)switch(b.prev=b.next){case 0:if(c=1<i.length&&void 0!==i[1]?i[1]:null,d=_core["default"].Global_get(lname_filter,a),Array.isArray(d)&&0!=d.length){b.next=4;break}return b.abrupt("return",c);case 4:d.sort(function(c,a){return c.order>a.order?1:-1}),e=c,f=0;case 7:if(!(f<d.length)){b.next=16;break}return g=d[f],b.next=11,g.action(e);case 11:h=b.sent,e=h;case 13:f++,b.next=7;break;case 16:return b.abrupt("return",e);case 17:case"end":return b.stop()}},b)})),_apply_filter.apply(this,arguments)}function apply_filter_sync(a){var b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:null,c=_core["default"].Global_get(lname_filter,a);if(!Array.isArray(c)||0==c.length)return b;c.sort(function(c,a){return c.order>a.order?1:-1});/* lower order gets executed first */for(var d=b,e=0;e<c.length;e++){var f=c[e],g=f.action(d);//console.log("filtered ", previous_value, " --> ", new_value);
24
24
  g!==void 0&&(d=g)}return d}/* -------------------------------------------------------------------------- */ /**
25
25
  * Adds a filter until the current component unmounts
26
26
  * @param key
27
27
  * @param action
28
- * @param priority
28
+ * @param order
29
29
  * @returns
30
30
  */function hold_add_filter(a,b){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:10,d=_react["default"].useCallback(b,[]);_react["default"].useEffect(function(){return add_filter(a,d,c),function(){remove_filter(a,d)}},[])}
@@ -4,10 +4,10 @@ type viewType = React.ReactNode | ((props: any) => React.ReactNode);
4
4
  * Adds a view to view list
5
5
  * @param key
6
6
  * @param action action of the filter
7
- * @param priority filters with lower priority are executed first
7
+ * @param order filters with lower order are executed first
8
8
  * @returns
9
9
  */
10
- export declare function add_view(key: string, view: viewType, priority?: number): any;
10
+ export declare function add_view(key: string, view: viewType, order?: number): any;
11
11
  /**
12
12
  *
13
13
  * @param view_key
@@ -2,10 +2,10 @@
2
2
  * Adds a view to view list
3
3
  * @param key
4
4
  * @param action action of the filter
5
- * @param priority filters with lower priority are executed first
5
+ * @param order filters with lower order are executed first
6
6
  * @returns
7
- */function add_view(a,b){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:10;return _core["default"].Global_add(lname_views,a,{view_key:a,view:b,priority:c})}// export function remove_view(key: string, view: React.ReactNode ): any {
8
- // const view_object = {key: key, view: view, priority: priority};
7
+ */function add_view(a,b){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:10;return _core["default"].Global_add(lname_views,a,{view_key:a,view:b,order:c})}// export function remove_view(key: string, view: React.ReactNode ): any {
8
+ // const view_object = {key: key, view: view, order: order};
9
9
  // return glb.Global_add(lname_filter, key, view);
10
10
  // }
11
11
  /**
@@ -13,7 +13,7 @@
13
13
  * @param view_key
14
14
  * @param initialValue
15
15
  * @returns
16
- */function load_views(a,b,c){var d=_core["default"].Global_get(lname_views,a);return Array.isArray(d)&&0!=d.length?(d.sort(function(c,a){return c.priority>a.priority?1:-1}),d.map(function(a,b){return"function"==typeof a.view?a.view(_objectSpread(_objectSpread({},c),{},{key:b+""})):a.view})):b;/* lower priority gets executed first */}/**
16
+ */function load_views(a,b,c){var d=_core["default"].Global_get(lname_views,a);return Array.isArray(d)&&0!=d.length?(d.sort(function(c,a){return c.order>a.order?1:-1}),d.map(function(a,b){return"function"==typeof a.view?a.view(_objectSpread(_objectSpread({},c),{},{key:b+""})):a.view})):b;/* lower order gets executed first */}/**
17
17
  *
18
18
  * @param view_key
19
19
  * @param initialValue
@@ -0,0 +1,33 @@
1
+ type basketObject = {
2
+ [key: string]: basketItem;
3
+ };
4
+ type basketItemData = any;
5
+ type basketItem = {
6
+ quantity: number;
7
+ data: basketItemData;
8
+ };
9
+ /**
10
+ * shop basket helper functions
11
+ */
12
+ export declare class gbasket {
13
+ /**
14
+ * add `quantity` of `itemid` to basket
15
+ * @param itemid
16
+ * @param quantity
17
+ * @param data
18
+ * @returns
19
+ */
20
+ static add(itemid: any, quantity?: number, data?: basketItemData): Promise<any>;
21
+ /**
22
+ * set `quantity` of `itemid` to basket
23
+ * @param itemid
24
+ * @param quantity
25
+ * @param data
26
+ * @returns
27
+ */
28
+ static set(itemid: any, quantity?: number, data?: basketItemData): Promise<basketObject>;
29
+ static get(itemid: keyof basketObject): Promise<basketItem>;
30
+ static getAll(): Promise<basketObject>;
31
+ static clear(): Promise<any>;
32
+ }
33
+ export {};
@@ -0,0 +1,15 @@
1
+ "use strict";var _gstorage=require("./gstorage");Object.defineProperty(exports,"__esModule",{value:!0}),exports.gbasket=void 0;function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */function b(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function f(b,d,e,f){var g=d&&d.prototype instanceof k?d:k,h=Object.create(g.prototype),a=new B(f||[]);return E(h,"_invoke",{value:w(b,e,a)}),h}function j(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function k(){}function l(){}function m(){}function q(a){["next","throw","return"].forEach(function(c){b(a,c,function(a){return this._invoke(c,a)})})}function s(b,d){function c(e,f,g,i){var a=j(b[e],b,f);if("throw"!==a.type){var k=a.arg,l=k.value;return l&&"object"==_typeof(l)&&t.call(l,"__await")?d.resolve(l.__await).then(function(a){c("next",a,g,i)},function(a){c("throw",a,g,i)}):d.resolve(l).then(function(a){k.value=a,g(k)},function(a){return c("throw",a,g,i)})}i(a.arg)}var e;E(this,"_invoke",{value:function value(a,b){function f(){return new d(function(d,e){c(a,b,d,e)})}return e=e?e.then(f,f):f()}})}function w(a,b,d){var e="suspendedStart";return function(f,g){if(e==="executing")throw Error("Generator is already running");if("completed"===e){if("throw"===f)throw g;return{value:D,done:!0}}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var i=x(h,d);if(i){if(i===G)continue;return i}}if("next"===d.method)d.sent=d._sent=d.arg;else if("throw"===d.method){if("suspendedStart"===e)throw e="completed",d.arg;d.dispatchException(d.arg)}else"return"===d.method&&d.abrupt("return",d.arg);e="executing";var k=j(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===G)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}function x(b,c){var d=c.method,e=b.iterator[d];if(e===D)return c.delegate=null,"throw"===d&&b.iterator["return"]&&(c.method="return",c.arg=D,x(b,c),"throw"===c.method)||"return"!==d&&(c.method="throw",c.arg=new TypeError("The iterator does not provide a '"+d+"' method")),G;var f=j(e,b.iterator,c.arg);if("throw"===f.type)return c.method="throw",c.arg=f.arg,c.delegate=null,G;var g=f.arg;return g?g.done?(c[b.resultName]=g.value,c.next=b.nextLoc,"return"!==c.method&&(c.method="next",c.arg=D),c.delegate=null,G):g:(c.method="throw",c.arg=new TypeError("iterator result is not an object"),c.delegate=null,G)}function z(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function A(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function B(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(z,this),this.reset(!0)}function C(a){if(a||""===a){var b=a[F];if(b)return b.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var c=-1,d=function b(){for(;++c<a.length;)if(t.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=D,b.done=!0,b};return d.next=d}}throw new TypeError(_typeof(a)+" is not iterable")}_regeneratorRuntime=function(){return h};var D,h={},e=Object.prototype,t=e.hasOwnProperty,E=Object.defineProperty||function(a,b,c){a[b]=c.value},n="function"==typeof Symbol?Symbol:{},F=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",c=n.toStringTag||"@@toStringTag";try{b({},"")}catch(a){b=function(a,b,c){return a[b]=c}}h.wrap=f;var G={},i={};b(i,F,function(){return this});var o=Object.getPrototypeOf,d=o&&o(o(C([])));d&&d!==e&&t.call(d,F)&&(i=d);var r=m.prototype=k.prototype=Object.create(i);return l.prototype=m,E(r,"constructor",{value:m,configurable:!0}),E(m,"constructor",{value:l,configurable:!0}),l.displayName=b(m,c,"GeneratorFunction"),h.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===l||"GeneratorFunction"===(b.displayName||b.name))},h.mark=function(a){return Object.setPrototypeOf?Object.setPrototypeOf(a,m):(a.__proto__=m,b(a,c,"GeneratorFunction")),a.prototype=Object.create(r),a},h.awrap=function(a){return{__await:a}},q(s.prototype),b(s.prototype,a,function(){return this}),h.AsyncIterator=s,h.async=function(b,c,d,e,g){void 0===g&&(g=Promise);var j=new s(f(b,c,d,e),g);return h.isGeneratorFunction(c)?j:j.next().then(function(a){return a.done?a.value:j.next()})},q(r),b(r,c,"Generator"),b(r,F,function(){return this}),b(r,"toString",function(){return"[object Generator]"}),h.keys=function(a){var b=Object(a),c=[];for(var d in b)c.push(d);return c.reverse(),function a(){for(;c.length;){var d=c.pop();if(d in b)return a.value=d,a.done=!1,a}return a.done=!0,a}},h.values=C,B.prototype={constructor:B,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=D,this.done=!1,this.delegate=null,this.method="next",this.arg=D,this.tryEntries.forEach(A),!a)for(var b in this)"t"===b.charAt(0)&&t.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=D)},stop:function stop(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function dispatchException(b){function d(a,c){return h.type="throw",h.arg=b,e.next=a,c&&(e.method="next",e.arg=D),!!c}if(this.done)throw b;for(var e=this,f=this.tryEntries.length-1;0<=f;--f){var g=this.tryEntries[f],h=g.completion;if("root"===g.tryLoc)return d("end");if(g.tryLoc<=this.prev){var j=t.call(g,"catchLoc"),k=t.call(g,"finallyLoc");if(j&&k){if(this.prev<g.catchLoc)return d(g.catchLoc,!0);if(this.prev<g.finallyLoc)return d(g.finallyLoc)}else if(!j){if(!k)throw Error("try statement without catch or finally");if(this.prev<g.finallyLoc)return d(g.finallyLoc)}else if(this.prev<g.catchLoc)return d(g.catchLoc,!0)}}},abrupt:function abrupt(b,c){for(var d,e=this.tryEntries.length-1;0<=e;--e)if(d=this.tryEntries[e],d.tryLoc<=this.prev&&t.call(d,"finallyLoc")&&this.prev<d.finallyLoc){var f=d;break}f&&("break"===b||"continue"===b)&&f.tryLoc<=c&&c<=f.finallyLoc&&(f=null);var g=f?f.completion:{};return g.type=b,g.arg=c,f?(this.method="next",this.next=f.finallyLoc,G):this.complete(g)},complete:function complete(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),G},finish:function finish(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.finallyLoc===a)return this.complete(b.completion,b.afterLoc),A(b),G},catch:function _catch(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.tryLoc===a){var d=b.completion;if("throw"===d.type){var f=d.arg;A(b)}return f}throw Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:C(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=D),G}},h}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!=_typeof(a)||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}/**
2
+ * shop basket helper functions
3
+ */var gbasket=exports.gbasket=/*#__PURE__*/function(){function a(){_classCallCheck(this,a)}return _createClass(a,null,[{key:"add",value:(/**
4
+ * add `quantity` of `itemid` to basket
5
+ * @param itemid
6
+ * @param quantity
7
+ * @param data
8
+ * @returns
9
+ */function(){function a(){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){var c,d,e,f=arguments;return _regeneratorRuntime().wrap(function g(b){for(;1;)switch(b.prev=b.next){case 0:return c=1<f.length&&void 0!==f[1]?f[1]:1,d=2<f.length?f[2]:void 0,b.next=4,this.get(a);case 4:return e=b.sent,e&&(c+=e.quantity),b.next=8,this.set(a,c,d);case 8:return b.abrupt("return",b.sent);case 9:case"end":return b.stop()}},b,this)}));return a}()/**
10
+ * set `quantity` of `itemid` to basket
11
+ * @param itemid
12
+ * @param quantity
13
+ * @param data
14
+ * @returns
15
+ */)},{key:"set",value:(function(){function a(a){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){var c,d,e,f=arguments;return _regeneratorRuntime().wrap(function g(b){var h=Math.max;for(;1;)switch(b.prev=b.next){case 0:return c=1<f.length&&void 0!==f[1]?f[1]:1,d=2<f.length?f[2]:void 0,b.next=4,this.getAll();case 4:return e=b.sent,e[a]={data:null!==d&&void 0!==d?d:e[a],quantity:h(0,c)},b.next=8,_gstorage.gstorage.set("basket",e);case 8:return b.abrupt("return",e);case 9:case"end":return b.stop()}},b,this)}));return a}())},{key:"get",value:function(){function a(a){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){var c;return _regeneratorRuntime().wrap(function d(b){for(;1;)switch(b.prev=b.next){case 0:return b.next=2,this.getAll();case 2:return c=b.sent,b.abrupt("return",c[a]);case 4:case"end":return b.stop()}},b,this)}));return a}()},{key:"getAll",value:function(){function a(){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function a(){var b;return _regeneratorRuntime().wrap(function c(a){for(;1;)switch(a.prev=a.next){case 0:return a.next=2,_gstorage.gstorage.get("basket");case 2:if(b=a.sent,b&&"object"==_typeof(b)){a.next=5;break}return a.abrupt("return",{});case 5:return a.abrupt("return",b);case 6:case"end":return a.stop()}},a)}));return a}()},{key:"clear",value:function(){function a(){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function a(){return _regeneratorRuntime().wrap(function b(a){for(;1;)switch(a.prev=a.next){case 0:return a.next=2,_gstorage.gstorage.set("basket",{});case 2:return a.abrupt("return",a.sent);case 3:case"end":return a.stop()}},a)}));return a}()}])}();
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ "use strict";var _index=require("./index");function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */function b(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function f(b,d,e,f){var g=d&&d.prototype instanceof k?d:k,h=Object.create(g.prototype),a=new B(f||[]);return E(h,"_invoke",{value:w(b,e,a)}),h}function j(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function k(){}function l(){}function m(){}function q(a){["next","throw","return"].forEach(function(c){b(a,c,function(a){return this._invoke(c,a)})})}function s(b,d){function c(e,f,g,i){var a=j(b[e],b,f);if("throw"!==a.type){var k=a.arg,l=k.value;return l&&"object"==_typeof(l)&&t.call(l,"__await")?d.resolve(l.__await).then(function(a){c("next",a,g,i)},function(a){c("throw",a,g,i)}):d.resolve(l).then(function(a){k.value=a,g(k)},function(a){return c("throw",a,g,i)})}i(a.arg)}var e;E(this,"_invoke",{value:function value(a,b){function f(){return new d(function(d,e){c(a,b,d,e)})}return e=e?e.then(f,f):f()}})}function w(a,b,d){var e="suspendedStart";return function(f,g){if(e==="executing")throw Error("Generator is already running");if("completed"===e){if("throw"===f)throw g;return{value:D,done:!0}}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var i=x(h,d);if(i){if(i===G)continue;return i}}if("next"===d.method)d.sent=d._sent=d.arg;else if("throw"===d.method){if("suspendedStart"===e)throw e="completed",d.arg;d.dispatchException(d.arg)}else"return"===d.method&&d.abrupt("return",d.arg);e="executing";var k=j(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===G)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}function x(b,c){var d=c.method,e=b.iterator[d];if(e===D)return c.delegate=null,"throw"===d&&b.iterator["return"]&&(c.method="return",c.arg=D,x(b,c),"throw"===c.method)||"return"!==d&&(c.method="throw",c.arg=new TypeError("The iterator does not provide a '"+d+"' method")),G;var f=j(e,b.iterator,c.arg);if("throw"===f.type)return c.method="throw",c.arg=f.arg,c.delegate=null,G;var g=f.arg;return g?g.done?(c[b.resultName]=g.value,c.next=b.nextLoc,"return"!==c.method&&(c.method="next",c.arg=D),c.delegate=null,G):g:(c.method="throw",c.arg=new TypeError("iterator result is not an object"),c.delegate=null,G)}function z(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function A(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function B(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(z,this),this.reset(!0)}function C(a){if(a||""===a){var b=a[F];if(b)return b.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var c=-1,d=function b(){for(;++c<a.length;)if(t.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=D,b.done=!0,b};return d.next=d}}throw new TypeError(_typeof(a)+" is not iterable")}_regeneratorRuntime=function(){return h};var D,h={},e=Object.prototype,t=e.hasOwnProperty,E=Object.defineProperty||function(a,b,c){a[b]=c.value},n="function"==typeof Symbol?Symbol:{},F=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",c=n.toStringTag||"@@toStringTag";try{b({},"")}catch(a){b=function(a,b,c){return a[b]=c}}h.wrap=f;var G={},i={};b(i,F,function(){return this});var o=Object.getPrototypeOf,d=o&&o(o(C([])));d&&d!==e&&t.call(d,F)&&(i=d);var r=m.prototype=k.prototype=Object.create(i);return l.prototype=m,E(r,"constructor",{value:m,configurable:!0}),E(m,"constructor",{value:l,configurable:!0}),l.displayName=b(m,c,"GeneratorFunction"),h.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===l||"GeneratorFunction"===(b.displayName||b.name))},h.mark=function(a){return Object.setPrototypeOf?Object.setPrototypeOf(a,m):(a.__proto__=m,b(a,c,"GeneratorFunction")),a.prototype=Object.create(r),a},h.awrap=function(a){return{__await:a}},q(s.prototype),b(s.prototype,a,function(){return this}),h.AsyncIterator=s,h.async=function(b,c,d,e,g){void 0===g&&(g=Promise);var j=new s(f(b,c,d,e),g);return h.isGeneratorFunction(c)?j:j.next().then(function(a){return a.done?a.value:j.next()})},q(r),b(r,c,"Generator"),b(r,F,function(){return this}),b(r,"toString",function(){return"[object Generator]"}),h.keys=function(a){var b=Object(a),c=[];for(var d in b)c.push(d);return c.reverse(),function a(){for(;c.length;){var d=c.pop();if(d in b)return a.value=d,a.done=!1,a}return a.done=!0,a}},h.values=C,B.prototype={constructor:B,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=D,this.done=!1,this.delegate=null,this.method="next",this.arg=D,this.tryEntries.forEach(A),!a)for(var b in this)"t"===b.charAt(0)&&t.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=D)},stop:function stop(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function dispatchException(b){function d(a,c){return h.type="throw",h.arg=b,e.next=a,c&&(e.method="next",e.arg=D),!!c}if(this.done)throw b;for(var e=this,f=this.tryEntries.length-1;0<=f;--f){var g=this.tryEntries[f],h=g.completion;if("root"===g.tryLoc)return d("end");if(g.tryLoc<=this.prev){var j=t.call(g,"catchLoc"),k=t.call(g,"finallyLoc");if(j&&k){if(this.prev<g.catchLoc)return d(g.catchLoc,!0);if(this.prev<g.finallyLoc)return d(g.finallyLoc)}else if(!j){if(!k)throw Error("try statement without catch or finally");if(this.prev<g.finallyLoc)return d(g.finallyLoc)}else if(this.prev<g.catchLoc)return d(g.catchLoc,!0)}}},abrupt:function abrupt(b,c){for(var d,e=this.tryEntries.length-1;0<=e;--e)if(d=this.tryEntries[e],d.tryLoc<=this.prev&&t.call(d,"finallyLoc")&&this.prev<d.finallyLoc){var f=d;break}f&&("break"===b||"continue"===b)&&f.tryLoc<=c&&c<=f.finallyLoc&&(f=null);var g=f?f.completion:{};return g.type=b,g.arg=c,f?(this.method="next",this.next=f.finallyLoc,G):this.complete(g)},complete:function complete(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),G},finish:function finish(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.finallyLoc===a)return this.complete(b.completion,b.afterLoc),A(b),G},catch:function _catch(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.tryLoc===a){var d=b.completion;if("throw"===d.type){var f=d.arg;A(b)}return f}throw Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:C(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=D),G}},h}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}describe("gbasket",function(){beforeEach(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function a(){return _regeneratorRuntime().wrap(function b(a){for(;1;)switch(a.prev=a.next){case 0:return a.next=2,_index.gbasket.clear();case 2:case"end":return a.stop()}},a)}))),it("addItem",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function a(){var b;return _regeneratorRuntime().wrap(function c(a){for(;1;)switch(a.prev=a.next){case 0:return a.next=2,_index.gbasket.add("test",1);case 2:return a.next=4,_index.gbasket.add("test",1);case 4:return a.next=6,_index.gbasket.get("test");case 6:return b=a.sent,a.t0=expect,a.next=10,b;case 10:return a.t1=a.sent.quantity,(0,a.t0)(a.t1).toBe(2),a.next=14,_index.gbasket.add("test",1);case 14:return a.next=16,_index.gbasket.get("test");case 16:return b=a.sent,a.t2=expect,a.next=20,b;case 20:a.t3=a.sent.quantity,(0,a.t2)(a.t3).toBe(3);case 22:case"end":return a.stop()}},a)}))),it("setItem",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function a(){var b;return _regeneratorRuntime().wrap(function c(a){for(;1;)switch(a.prev=a.next){case 0:return a.next=2,_index.gbasket.add("test",1);case 2:return a.next=4,_index.gbasket.add("test",1);case 4:return a.next=6,_index.gbasket.get("test");case 6:return b=a.sent,a.t0=expect,a.next=10,b;case 10:return a.t1=a.sent.quantity,(0,a.t0)(a.t1).toBe(2),a.next=14,_index.gbasket.set("test",1);case 14:return a.next=16,_index.gbasket.get("test");case 16:return b=a.sent,a.t2=expect,a.next=20,b;case 20:a.t3=a.sent.quantity,(0,a.t2)(a.t3).toBe(1);case 22:case"end":return a.stop()}},a)}))),it("getItems",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function a(){return _regeneratorRuntime().wrap(function b(a){for(;1;)switch(a.prev=a.next){case 0:return a.next=2,_index.gbasket.add("test1",1);case 2:return a.next=4,_index.gbasket.add("test1",1);case 4:return a.next=6,_index.gbasket.add("test2",1);case 6:return a.next=8,_index.gbasket.add("test2",1);case 8:return a.t0=expect,a.t1=Object,a.next=12,_index.gbasket.getAll();case 12:return a.t2=a.sent,a.t3=a.t1.keys.call(a.t1,a.t2),(0,a.t0)(a.t3).toHaveLength(2),a.next=17,_index.gbasket.add("test3",1);case 17:return a.t4=expect,a.t5=Object,a.next=21,_index.gbasket.getAll();case 21:a.t6=a.sent,a.t7=a.t5.keys.call(a.t5,a.t6),(0,a.t4)(a.t7).toHaveLength(3);case 24:case"end":return a.stop()}},a)})))});
@@ -0,0 +1,46 @@
1
+ export interface setVarOptions {
2
+ normal?: boolean;
3
+ session?: boolean;
4
+ storage?: boolean;
5
+ local_storage?: boolean;
6
+ json?: boolean;
7
+ }
8
+ export declare class gstorage {
9
+ static add(key: string, value: any, options?: setVarOptions): Promise<any>;
10
+ static getSync(key: string, options?: setVarOptions): any;
11
+ static setSync<T>(key: string, value: T, options?: setVarOptions): T;
12
+ static get(key: string, options?: setVarOptions): Promise<any>;
13
+ static set(key: string, value: any, options?: setVarOptions): Promise<any>;
14
+ static hold<T>(key: string, value: T, options?: setVarOptions): T;
15
+ private static _optional_dec;
16
+ private static _optional_enc;
17
+ /**
18
+ * @deprecated
19
+ */
20
+ static add_var(key: string, value: any, options?: setVarOptions): Promise<any>;
21
+ /**
22
+ * @deprecated
23
+ */
24
+ static get_var_sync(key: string, options?: setVarOptions): any;
25
+ static set_var_sync(key: string, value: any, options?: setVarOptions): any;
26
+ /**
27
+ * @deprecated
28
+ */
29
+ static get_var(key: string, options?: setVarOptions): Promise<any>;
30
+ /**
31
+ * @deprecated
32
+ */
33
+ static get_sync(key: string, options?: setVarOptions): any;
34
+ /**
35
+ * @deprecated
36
+ */
37
+ static set_var(key: string, value: any, options?: setVarOptions): Promise<any>;
38
+ /**
39
+ * @deprecated
40
+ */
41
+ static set_sync(key: string, value: any, options?: setVarOptions): any;
42
+ /**
43
+ * @deprecated
44
+ */
45
+ static hold_var<T>(key: string, value: T, options?: setVarOptions): T;
46
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.gstorage=void 0;var _asyncStorage=_interopRequireDefault(require("@react-native-async-storage/async-storage")),_react=_interopRequireDefault(require("react")),_core=_interopRequireDefault(require("../core"));function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */function b(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function f(b,d,e,f){var g=d&&d.prototype instanceof k?d:k,h=Object.create(g.prototype),a=new B(f||[]);return E(h,"_invoke",{value:w(b,e,a)}),h}function j(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function k(){}function l(){}function m(){}function q(a){["next","throw","return"].forEach(function(c){b(a,c,function(a){return this._invoke(c,a)})})}function s(b,d){function c(e,f,g,i){var a=j(b[e],b,f);if("throw"!==a.type){var k=a.arg,l=k.value;return l&&"object"==_typeof(l)&&t.call(l,"__await")?d.resolve(l.__await).then(function(a){c("next",a,g,i)},function(a){c("throw",a,g,i)}):d.resolve(l).then(function(a){k.value=a,g(k)},function(a){return c("throw",a,g,i)})}i(a.arg)}var e;E(this,"_invoke",{value:function value(a,b){function f(){return new d(function(d,e){c(a,b,d,e)})}return e=e?e.then(f,f):f()}})}function w(a,b,d){var e="suspendedStart";return function(f,g){if(e==="executing")throw Error("Generator is already running");if("completed"===e){if("throw"===f)throw g;return{value:D,done:!0}}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var i=x(h,d);if(i){if(i===G)continue;return i}}if("next"===d.method)d.sent=d._sent=d.arg;else if("throw"===d.method){if("suspendedStart"===e)throw e="completed",d.arg;d.dispatchException(d.arg)}else"return"===d.method&&d.abrupt("return",d.arg);e="executing";var k=j(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===G)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}function x(b,c){var d=c.method,e=b.iterator[d];if(e===D)return c.delegate=null,"throw"===d&&b.iterator["return"]&&(c.method="return",c.arg=D,x(b,c),"throw"===c.method)||"return"!==d&&(c.method="throw",c.arg=new TypeError("The iterator does not provide a '"+d+"' method")),G;var f=j(e,b.iterator,c.arg);if("throw"===f.type)return c.method="throw",c.arg=f.arg,c.delegate=null,G;var g=f.arg;return g?g.done?(c[b.resultName]=g.value,c.next=b.nextLoc,"return"!==c.method&&(c.method="next",c.arg=D),c.delegate=null,G):g:(c.method="throw",c.arg=new TypeError("iterator result is not an object"),c.delegate=null,G)}function z(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function A(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function B(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(z,this),this.reset(!0)}function C(a){if(a||""===a){var b=a[F];if(b)return b.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var c=-1,d=function b(){for(;++c<a.length;)if(t.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=D,b.done=!0,b};return d.next=d}}throw new TypeError(_typeof(a)+" is not iterable")}_regeneratorRuntime=function(){return h};var D,h={},e=Object.prototype,t=e.hasOwnProperty,E=Object.defineProperty||function(a,b,c){a[b]=c.value},n="function"==typeof Symbol?Symbol:{},F=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",c=n.toStringTag||"@@toStringTag";try{b({},"")}catch(a){b=function(a,b,c){return a[b]=c}}h.wrap=f;var G={},i={};b(i,F,function(){return this});var o=Object.getPrototypeOf,d=o&&o(o(C([])));d&&d!==e&&t.call(d,F)&&(i=d);var r=m.prototype=k.prototype=Object.create(i);return l.prototype=m,E(r,"constructor",{value:m,configurable:!0}),E(m,"constructor",{value:l,configurable:!0}),l.displayName=b(m,c,"GeneratorFunction"),h.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===l||"GeneratorFunction"===(b.displayName||b.name))},h.mark=function(a){return Object.setPrototypeOf?Object.setPrototypeOf(a,m):(a.__proto__=m,b(a,c,"GeneratorFunction")),a.prototype=Object.create(r),a},h.awrap=function(a){return{__await:a}},q(s.prototype),b(s.prototype,a,function(){return this}),h.AsyncIterator=s,h.async=function(b,c,d,e,g){void 0===g&&(g=Promise);var j=new s(f(b,c,d,e),g);return h.isGeneratorFunction(c)?j:j.next().then(function(a){return a.done?a.value:j.next()})},q(r),b(r,c,"Generator"),b(r,F,function(){return this}),b(r,"toString",function(){return"[object Generator]"}),h.keys=function(a){var b=Object(a),c=[];for(var d in b)c.push(d);return c.reverse(),function a(){for(;c.length;){var d=c.pop();if(d in b)return a.value=d,a.done=!1,a}return a.done=!0,a}},h.values=C,B.prototype={constructor:B,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=D,this.done=!1,this.delegate=null,this.method="next",this.arg=D,this.tryEntries.forEach(A),!a)for(var b in this)"t"===b.charAt(0)&&t.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=D)},stop:function stop(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function dispatchException(b){function d(a,c){return h.type="throw",h.arg=b,e.next=a,c&&(e.method="next",e.arg=D),!!c}if(this.done)throw b;for(var e=this,f=this.tryEntries.length-1;0<=f;--f){var g=this.tryEntries[f],h=g.completion;if("root"===g.tryLoc)return d("end");if(g.tryLoc<=this.prev){var j=t.call(g,"catchLoc"),k=t.call(g,"finallyLoc");if(j&&k){if(this.prev<g.catchLoc)return d(g.catchLoc,!0);if(this.prev<g.finallyLoc)return d(g.finallyLoc)}else if(!j){if(!k)throw Error("try statement without catch or finally");if(this.prev<g.finallyLoc)return d(g.finallyLoc)}else if(this.prev<g.catchLoc)return d(g.catchLoc,!0)}}},abrupt:function abrupt(b,c){for(var d,e=this.tryEntries.length-1;0<=e;--e)if(d=this.tryEntries[e],d.tryLoc<=this.prev&&t.call(d,"finallyLoc")&&this.prev<d.finallyLoc){var f=d;break}f&&("break"===b||"continue"===b)&&f.tryLoc<=c&&c<=f.finallyLoc&&(f=null);var g=f?f.completion:{};return g.type=b,g.arg=c,f?(this.method="next",this.next=f.finallyLoc,G):this.complete(g)},complete:function complete(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),G},finish:function finish(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.finallyLoc===a)return this.complete(b.completion,b.afterLoc),A(b),G},catch:function _catch(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.tryLoc===a){var d=b.completion;if("throw"===d.type){var f=d.arg;A(b)}return f}throw Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:C(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=D),G}},h}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!=_typeof(a)||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var crypto,lname="list_var",ALWAYS_GLOBAL_SET=!0,gstorage=exports.gstorage=/*#__PURE__*/function(){function a(){_classCallCheck(this,a)}return _createClass(a,null,[{key:"add",value:function(){function a(){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function d(a,b,c){var e;return _regeneratorRuntime().wrap(function f(d){for(;1;)switch(d.prev=d.next){case 0:return d.next=2,this.get(a,c);case 2:return e=d.sent,Array.isArray(e)||(e=[]),e.push(b),d.next=7,this.set(a,e,c);case 7:return d.abrupt("return",e);case 8:case"end":return d.stop()}},d,this)}));return a}()},{key:"getSync",value:function getSync(b,c){c||(c={});var d=_core["default"].Global_get(lname,b);if("string"==typeof d&&(d=a._optional_dec(d)),c.json&&"string"==typeof d)try{return JSON.parse(d)}catch(a){}return d}},{key:"setSync",value:function setSync(b,c,d){d||(d={});var e=c;if(d.json&&"function"!=typeof e)try{e=JSON.stringify(e)}catch(a){}return"string"==typeof e&&(e=a._optional_enc(e)),_core["default"].Global_set(lname,b,e)}},{key:"get",value:function(){function b(a,b){return c.apply(this,arguments)}var c=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function d(b,c){var e,f,g,h;return _regeneratorRuntime().wrap(function i(d){for(;1;)switch(d.prev=d.next){case 0:return g=function a(){return g=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function a(){var d;return _regeneratorRuntime().wrap(function f(a){for(;1;)switch(a.prev=a.next){case 0:if(d=null,!ALWAYS_GLOBAL_SET&&c&&!c.normal&&(c.local_storage||c.session||c.storage)){a.next=5;break}if(d=_core["default"].Global_get(lname,b),null==d){a.next=5;break}return a.abrupt("return",d);case 5:if(c){a.next=7;break}return a.abrupt("return",void 0);case 7:if(!c.local_storage){a.next=13;break}if(e){a.next=10;break}throw new Error("you cant use localStorage storage in node");case 10:if(d=localStorage[b],null==d){a.next=13;break}return a.abrupt("return",d);case 13:if(!c.session){a.next=19;break}if(e){a.next=16;break}throw new Error("you cant use session storage in node");case 16:if(d=window.sessionStorage.getItem(b),null==d){a.next=19;break}return a.abrupt("return",d);case 19:if(!c.storage){a.next=27;break}if(e){a.next=22;break}throw new Error("you cant use AsyncStorage storage in node");case 22:return a.next=24,_asyncStorage["default"].getItem(b);case 24:if(d=a.sent,null==d){a.next=27;break}return a.abrupt("return",d);case 27:return a.abrupt("return",void 0);case 28:case"end":return a.stop()}},a)})),g.apply(this,arguments)},f=function a(){return g.apply(this,arguments)},c||(c={}),e="undefined"!=typeof window,d.next=6,f();case 6:if(h=d.sent,"string"!=typeof h){d.next=18;break}return d.next=10,a._optional_dec(h);case 10:if(h=d.sent,!c.json){d.next=18;break}return d.prev=12,d.abrupt("return",JSON.parse(h));case 16:d.prev=16,d.t0=d["catch"](12);case 18:return d.abrupt("return",h);case 19:case"end":return d.stop()}},d,null,[[12,16]])}));return b}()},{key:"set",value:function(){function b(a,b,d){return c.apply(this,arguments)}var c=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function e(b,c,d){var f,g,h,i,j,k;return _regeneratorRuntime().wrap(function l(e){for(;1;)switch(e.prev=e.next){case 0:/* ----------------------- optionally convert to json ----------------------- */if(d||(d={}),f=c,g="object"===_typeof(f)?f:void 0,h="undefined"!=typeof window,d.json&&null!=f&&"function"!=typeof f)try{f=JSON.stringify(f)}catch(a){}/* -------------------------------------------------------------------------- */if(i="string"==typeof f,i&&(f=a._optional_enc(f)),j=null==f||""==f,k=!1,!d.local_storage){e.next=20;break}if(h){e.next=12;break}throw new Error("you cant use localStorage storage in node");case 12:if(!j){e.next=16;break}delete localStorage[b],e.next=19;break;case 16:if(i){e.next=18;break}throw new Error("You cant save non-string values in local_storage !");case 18:localStorage[b]=f;case 19:k=!0;case 20:if(!d.session){e.next=31;break}if(h){e.next=23;break}throw new Error("you cant use session storage in node");case 23:if(!j){e.next=27;break}window.sessionStorage.removeItem(b),e.next=30;break;case 27:if(i){e.next=29;break}throw new Error("You cant save non-string values in session ! "+f);case 29:window.sessionStorage.setItem(b,f);case 30:k=!0;case 31:if(!d.storage){e.next=44;break}if(h){e.next=34;break}throw new Error("you cant use AsyncStorage in node");case 34:if(!j){e.next=39;break}return e.next=37,_asyncStorage["default"].removeItem(b);case 37:e.next=43;break;case 39:if(i){e.next=41;break}throw new Error("You cant save non-string values in AsyncStorage !");case 41:return e.next=43,_asyncStorage["default"].setItem(b,f);case 43:k=!0;case 44:return(ALWAYS_GLOBAL_SET||!k||d.normal)&&_core["default"].Global_set(lname,b,null!==g&&void 0!==g?g:f),e.abrupt("return",f);case 46:case"end":return e.stop()}},e)}));return b}()},{key:"hold",value:function hold(b,c,d){return _react["default"].useEffect(function(){return a.set(b,c,d),function(){a.set(b,null,d)}},[c]),c}/* -------------------------------------------------------------------------- */ /* if we have crypto support use it, dont throw error otherwise */ /* -------------------------------------------------------------------------- */},{key:"_optional_dec",value:function _optional_dec(a){return crypto?crypto.decrypt(a):a.replaceAll("SECRET","")}},{key:"_optional_enc",value:function _optional_enc(a){return crypto?crypto.encrypt(a):a+"SECRET"}/* -------------------------------------------------------------------------- */ /* deprected functions */ /* -------------------------------------------------------------------------- */ /**
2
+ * @deprecated
3
+ */},{key:"add_var",value:(function(){function b(a,b,d){return c.apply(this,arguments)}var c=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function e(b,c,d){return _regeneratorRuntime().wrap(function f(e){for(;1;)switch(e.prev=e.next){case 0:return e.next=2,a.add(b,c,d);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)}));return b}()/**
4
+ * @deprecated
5
+ */)},{key:"get_var_sync",value:function get_var_sync(b,c){return a.getSync(b,c)}},{key:"set_var_sync",value:function set_var_sync(b,c,d){return a.setSync(b,c,d)}/**
6
+ * @deprecated
7
+ */},{key:"get_var",value:(function(){function b(a,b){return c.apply(this,arguments)}var c=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function d(b,c){return _regeneratorRuntime().wrap(function e(d){for(;1;)switch(d.prev=d.next){case 0:return d.next=2,a.get(b,c);case 2:return d.abrupt("return",d.sent);case 3:case"end":return d.stop()}},d)}));return b}()/**
8
+ * @deprecated
9
+ */)},{key:"get_sync",value:function get_sync(b,c){return a.getSync(b,c)}/**
10
+ * @deprecated
11
+ */},{key:"set_var",value:(function(){function b(a,b,d){return c.apply(this,arguments)}var c=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function e(b,c,d){return _regeneratorRuntime().wrap(function f(e){for(;1;)switch(e.prev=e.next){case 0:return e.next=2,a.set(b,c,d);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)}));return b}()/**
12
+ * @deprecated
13
+ */)},{key:"set_sync",value:function set_sync(b,c,d){return a.setSync(b,c,d)}/**
14
+ * @deprecated
15
+ */},{key:"hold_var",value:function hold_var(b,c,d){return a.hold(b,c,d)}}])}();
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ "use strict";var _index=require("./index");function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */function b(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function f(b,d,e,f){var g=d&&d.prototype instanceof k?d:k,h=Object.create(g.prototype),a=new B(f||[]);return E(h,"_invoke",{value:w(b,e,a)}),h}function j(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function k(){}function l(){}function m(){}function q(a){["next","throw","return"].forEach(function(c){b(a,c,function(a){return this._invoke(c,a)})})}function s(b,d){function c(e,f,g,i){var a=j(b[e],b,f);if("throw"!==a.type){var k=a.arg,l=k.value;return l&&"object"==_typeof(l)&&t.call(l,"__await")?d.resolve(l.__await).then(function(a){c("next",a,g,i)},function(a){c("throw",a,g,i)}):d.resolve(l).then(function(a){k.value=a,g(k)},function(a){return c("throw",a,g,i)})}i(a.arg)}var e;E(this,"_invoke",{value:function value(a,b){function f(){return new d(function(d,e){c(a,b,d,e)})}return e=e?e.then(f,f):f()}})}function w(a,b,d){var e="suspendedStart";return function(f,g){if(e==="executing")throw Error("Generator is already running");if("completed"===e){if("throw"===f)throw g;return{value:D,done:!0}}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var i=x(h,d);if(i){if(i===G)continue;return i}}if("next"===d.method)d.sent=d._sent=d.arg;else if("throw"===d.method){if("suspendedStart"===e)throw e="completed",d.arg;d.dispatchException(d.arg)}else"return"===d.method&&d.abrupt("return",d.arg);e="executing";var k=j(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===G)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}function x(b,c){var d=c.method,e=b.iterator[d];if(e===D)return c.delegate=null,"throw"===d&&b.iterator["return"]&&(c.method="return",c.arg=D,x(b,c),"throw"===c.method)||"return"!==d&&(c.method="throw",c.arg=new TypeError("The iterator does not provide a '"+d+"' method")),G;var f=j(e,b.iterator,c.arg);if("throw"===f.type)return c.method="throw",c.arg=f.arg,c.delegate=null,G;var g=f.arg;return g?g.done?(c[b.resultName]=g.value,c.next=b.nextLoc,"return"!==c.method&&(c.method="next",c.arg=D),c.delegate=null,G):g:(c.method="throw",c.arg=new TypeError("iterator result is not an object"),c.delegate=null,G)}function z(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function A(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function B(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(z,this),this.reset(!0)}function C(a){if(a||""===a){var b=a[F];if(b)return b.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var c=-1,d=function b(){for(;++c<a.length;)if(t.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=D,b.done=!0,b};return d.next=d}}throw new TypeError(_typeof(a)+" is not iterable")}_regeneratorRuntime=function(){return h};var D,h={},e=Object.prototype,t=e.hasOwnProperty,E=Object.defineProperty||function(a,b,c){a[b]=c.value},n="function"==typeof Symbol?Symbol:{},F=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",c=n.toStringTag||"@@toStringTag";try{b({},"")}catch(a){b=function(a,b,c){return a[b]=c}}h.wrap=f;var G={},i={};b(i,F,function(){return this});var o=Object.getPrototypeOf,d=o&&o(o(C([])));d&&d!==e&&t.call(d,F)&&(i=d);var r=m.prototype=k.prototype=Object.create(i);return l.prototype=m,E(r,"constructor",{value:m,configurable:!0}),E(m,"constructor",{value:l,configurable:!0}),l.displayName=b(m,c,"GeneratorFunction"),h.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===l||"GeneratorFunction"===(b.displayName||b.name))},h.mark=function(a){return Object.setPrototypeOf?Object.setPrototypeOf(a,m):(a.__proto__=m,b(a,c,"GeneratorFunction")),a.prototype=Object.create(r),a},h.awrap=function(a){return{__await:a}},q(s.prototype),b(s.prototype,a,function(){return this}),h.AsyncIterator=s,h.async=function(b,c,d,e,g){void 0===g&&(g=Promise);var j=new s(f(b,c,d,e),g);return h.isGeneratorFunction(c)?j:j.next().then(function(a){return a.done?a.value:j.next()})},q(r),b(r,c,"Generator"),b(r,F,function(){return this}),b(r,"toString",function(){return"[object Generator]"}),h.keys=function(a){var b=Object(a),c=[];for(var d in b)c.push(d);return c.reverse(),function a(){for(;c.length;){var d=c.pop();if(d in b)return a.value=d,a.done=!1,a}return a.done=!0,a}},h.values=C,B.prototype={constructor:B,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=D,this.done=!1,this.delegate=null,this.method="next",this.arg=D,this.tryEntries.forEach(A),!a)for(var b in this)"t"===b.charAt(0)&&t.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=D)},stop:function stop(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function dispatchException(b){function d(a,c){return h.type="throw",h.arg=b,e.next=a,c&&(e.method="next",e.arg=D),!!c}if(this.done)throw b;for(var e=this,f=this.tryEntries.length-1;0<=f;--f){var g=this.tryEntries[f],h=g.completion;if("root"===g.tryLoc)return d("end");if(g.tryLoc<=this.prev){var j=t.call(g,"catchLoc"),k=t.call(g,"finallyLoc");if(j&&k){if(this.prev<g.catchLoc)return d(g.catchLoc,!0);if(this.prev<g.finallyLoc)return d(g.finallyLoc)}else if(!j){if(!k)throw Error("try statement without catch or finally");if(this.prev<g.finallyLoc)return d(g.finallyLoc)}else if(this.prev<g.catchLoc)return d(g.catchLoc,!0)}}},abrupt:function abrupt(b,c){for(var d,e=this.tryEntries.length-1;0<=e;--e)if(d=this.tryEntries[e],d.tryLoc<=this.prev&&t.call(d,"finallyLoc")&&this.prev<d.finallyLoc){var f=d;break}f&&("break"===b||"continue"===b)&&f.tryLoc<=c&&c<=f.finallyLoc&&(f=null);var g=f?f.completion:{};return g.type=b,g.arg=c,f?(this.method="next",this.next=f.finallyLoc,G):this.complete(g)},complete:function complete(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),G},finish:function finish(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.finallyLoc===a)return this.complete(b.completion,b.afterLoc),A(b),G},catch:function _catch(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.tryLoc===a){var d=b.completion;if("throw"===d.type){var f=d.arg;A(b)}return f}throw Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:C(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=D),G}},h}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}describe("gstorage",function(){var a={name:"reza"};it("set_var_sync",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(){return _regeneratorRuntime().wrap(function c(b){for(;1;)switch(b.prev=b.next){case 0:expect(_index.gstorage.setSync("test",a)).toBe(a),expect(_index.gstorage.getSync("test")).toBe(a);case 2:case"end":return b.stop()}},b)}))),test("set_var get_var",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function a(){var b,c,d;return _regeneratorRuntime().wrap(function e(a){for(;1;)switch(a.prev=a.next){case 0:return b="hello",c={b4:"bbbb",abArray:["a","b"]},d=function f_square(b){return b*b},a.next=5,_index.gstorage.set("var_a",b);case 5:return a.next=7,_index.gstorage.set("var_b",c);case 7:return a.next=9,_index.gstorage.set("f_square",d);case 9:return a.t0=expect,a.next=12,_index.gstorage.get("var_a");case 12:return a.t1=a.sent,(0,a.t0)(a.t1).toStrictEqual(b),a.t2=expect,a.next=17,_index.gstorage.get("var_b");case 17:return a.t3=a.sent,(0,a.t2)(a.t3).toStrictEqual(c),a.t4=expect,a.next=22,_index.gstorage.get("f_square");case 22:a.t5=a.sent,(0,a.t4)(a.t5).toStrictEqual(d);case 24:case"end":return a.stop()}},a)}))),test("GlobalVar session and storage check",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function a(){var b,c;return _regeneratorRuntime().wrap(function d(a){for(;1;)switch(a.prev=a.next){case 0:return b={b4:"bbbb",abArray:["a","b"]},c={b2:"bb",baArray:["b","a"]},a.next=4,_index.gstorage.set("session_a",b,{session:!0,json:!0});case 4:return a.next=6,_index.gstorage.set("storage_a",c,{storage:!0,json:!0});case 6:return a.t0=expect,a.next=9,_index.gstorage.get("session_a",{session:!0,json:!0});case 9:return a.t1=a.sent,(0,a.t0)(a.t1).toStrictEqual(b),a.t2=expect,a.next=14,_index.gstorage.get("storage_a",{storage:!0,json:!0});case 14:a.t3=a.sent,(0,a.t2)(a.t3).toStrictEqual(c);case 16:case"end":return a.stop()}},a)}))),test("GlobalVar is it really global ?",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function a(){var b,c,d;return _regeneratorRuntime().wrap(function e(a){for(;1;)switch(a.prev=a.next){case 0:return b={b4:"bbbb",abArray:["a","b"]},c={b2:"bb",baArray:["b","a"]},a.next=4,_index.gstorage.get("f_square");case 4:return d=a.sent,expect(d(3)).toStrictEqual(9),a.t0=expect,a.next=9,_index.gstorage.get("session_a",{session:!0,json:!0});case 9:return a.t1=a.sent,(0,a.t0)(a.t1).toStrictEqual(b),a.t2=expect,a.next=14,_index.gstorage.get("storage_a",{storage:!0,json:!0});case 14:a.t3=a.sent,(0,a.t2)(a.t3).toStrictEqual(c);case 16:case"end":return a.stop()}},a)})))});
@@ -1 +1,2 @@
1
- export * from "./g_storage";
1
+ export * from "./gstorage";
2
+ export * from "./gbasket";
@@ -1 +1 @@
1
- "use strict";var _g_storage=require("./g_storage");Object.defineProperty(exports,"__esModule",{value:!0});Object.keys(_g_storage).forEach(function(a){"default"===a||"__esModule"===a||a in exports&&exports[a]===_g_storage[a]||Object.defineProperty(exports,a,{enumerable:!0,get:function get(){return _g_storage[a]}})});
1
+ "use strict";var _gstorage=require("./gstorage");var _gbasket=require("./gbasket");Object.defineProperty(exports,"__esModule",{value:!0});Object.keys(_gstorage).forEach(function(a){"default"===a||"__esModule"===a||a in exports&&exports[a]===_gstorage[a]||Object.defineProperty(exports,a,{enumerable:!0,get:function get(){return _gstorage[a]}})});Object.keys(_gbasket).forEach(function(a){"default"===a||"__esModule"===a||a in exports&&exports[a]===_gbasket[a]||Object.defineProperty(exports,a,{enumerable:!0,get:function get(){return _gbasket[a]}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/global",
3
- "version": "1.3.79",
3
+ "version": "1.3.81",
4
4
  "description": "Simple global functions and helpers",
5
5
  "author": "Azrideus",
6
6
  "license": "MIT",
@@ -1,13 +0,0 @@
1
- export interface setVarOptions {
2
- normal?: boolean;
3
- session?: boolean;
4
- storage?: boolean;
5
- local_storage?: boolean;
6
- json?: boolean;
7
- }
8
- export declare function add_var(key: string, value: any, options?: setVarOptions): Promise<any>;
9
- export declare function get_var_sync(key: string, options?: setVarOptions): any;
10
- export declare function set_var_sync<T>(key: string, value: T, options?: setVarOptions): T;
11
- export declare function get_var(key: string, options?: setVarOptions): Promise<any>;
12
- export declare function set_var(key: string, value: any, options?: setVarOptions): Promise<any>;
13
- export declare function hold_var<T>(key: string, value: T, options?: setVarOptions): T;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.add_var=add_var,exports.get_var=get_var,exports.get_var_sync=get_var_sync,exports.hold_var=hold_var,exports.set_var=set_var,exports.set_var_sync=set_var_sync;var _asyncStorage=_interopRequireDefault(require("@react-native-async-storage/async-storage")),_react=_interopRequireDefault(require("react")),_core=_interopRequireDefault(require("../core"));function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */function b(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function f(b,d,e,f){var g=d&&d.prototype instanceof k?d:k,h=Object.create(g.prototype),a=new B(f||[]);return E(h,"_invoke",{value:w(b,e,a)}),h}function j(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function k(){}function l(){}function m(){}function q(a){["next","throw","return"].forEach(function(c){b(a,c,function(a){return this._invoke(c,a)})})}function s(b,d){function c(e,f,g,i){var a=j(b[e],b,f);if("throw"!==a.type){var k=a.arg,l=k.value;return l&&"object"==_typeof(l)&&t.call(l,"__await")?d.resolve(l.__await).then(function(a){c("next",a,g,i)},function(a){c("throw",a,g,i)}):d.resolve(l).then(function(a){k.value=a,g(k)},function(a){return c("throw",a,g,i)})}i(a.arg)}var e;E(this,"_invoke",{value:function value(a,b){function f(){return new d(function(d,e){c(a,b,d,e)})}return e=e?e.then(f,f):f()}})}function w(a,b,d){var e="suspendedStart";return function(f,g){if(e==="executing")throw Error("Generator is already running");if("completed"===e){if("throw"===f)throw g;return{value:D,done:!0}}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var i=x(h,d);if(i){if(i===G)continue;return i}}if("next"===d.method)d.sent=d._sent=d.arg;else if("throw"===d.method){if("suspendedStart"===e)throw e="completed",d.arg;d.dispatchException(d.arg)}else"return"===d.method&&d.abrupt("return",d.arg);e="executing";var k=j(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===G)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}function x(b,c){var d=c.method,e=b.iterator[d];if(e===D)return c.delegate=null,"throw"===d&&b.iterator["return"]&&(c.method="return",c.arg=D,x(b,c),"throw"===c.method)||"return"!==d&&(c.method="throw",c.arg=new TypeError("The iterator does not provide a '"+d+"' method")),G;var f=j(e,b.iterator,c.arg);if("throw"===f.type)return c.method="throw",c.arg=f.arg,c.delegate=null,G;var g=f.arg;return g?g.done?(c[b.resultName]=g.value,c.next=b.nextLoc,"return"!==c.method&&(c.method="next",c.arg=D),c.delegate=null,G):g:(c.method="throw",c.arg=new TypeError("iterator result is not an object"),c.delegate=null,G)}function z(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function A(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function B(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(z,this),this.reset(!0)}function C(a){if(a||""===a){var b=a[F];if(b)return b.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var c=-1,d=function b(){for(;++c<a.length;)if(t.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=D,b.done=!0,b};return d.next=d}}throw new TypeError(_typeof(a)+" is not iterable")}_regeneratorRuntime=function(){return h};var D,h={},e=Object.prototype,t=e.hasOwnProperty,E=Object.defineProperty||function(a,b,c){a[b]=c.value},n="function"==typeof Symbol?Symbol:{},F=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",c=n.toStringTag||"@@toStringTag";try{b({},"")}catch(a){b=function(a,b,c){return a[b]=c}}h.wrap=f;var G={},i={};b(i,F,function(){return this});var o=Object.getPrototypeOf,d=o&&o(o(C([])));d&&d!==e&&t.call(d,F)&&(i=d);var r=m.prototype=k.prototype=Object.create(i);return l.prototype=m,E(r,"constructor",{value:m,configurable:!0}),E(m,"constructor",{value:l,configurable:!0}),l.displayName=b(m,c,"GeneratorFunction"),h.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===l||"GeneratorFunction"===(b.displayName||b.name))},h.mark=function(a){return Object.setPrototypeOf?Object.setPrototypeOf(a,m):(a.__proto__=m,b(a,c,"GeneratorFunction")),a.prototype=Object.create(r),a},h.awrap=function(a){return{__await:a}},q(s.prototype),b(s.prototype,a,function(){return this}),h.AsyncIterator=s,h.async=function(b,c,d,e,g){void 0===g&&(g=Promise);var j=new s(f(b,c,d,e),g);return h.isGeneratorFunction(c)?j:j.next().then(function(a){return a.done?a.value:j.next()})},q(r),b(r,c,"Generator"),b(r,F,function(){return this}),b(r,"toString",function(){return"[object Generator]"}),h.keys=function(a){var b=Object(a),c=[];for(var d in b)c.push(d);return c.reverse(),function a(){for(;c.length;){var d=c.pop();if(d in b)return a.value=d,a.done=!1,a}return a.done=!0,a}},h.values=C,B.prototype={constructor:B,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=D,this.done=!1,this.delegate=null,this.method="next",this.arg=D,this.tryEntries.forEach(A),!a)for(var b in this)"t"===b.charAt(0)&&t.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=D)},stop:function stop(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function dispatchException(b){function d(a,c){return h.type="throw",h.arg=b,e.next=a,c&&(e.method="next",e.arg=D),!!c}if(this.done)throw b;for(var e=this,f=this.tryEntries.length-1;0<=f;--f){var g=this.tryEntries[f],h=g.completion;if("root"===g.tryLoc)return d("end");if(g.tryLoc<=this.prev){var j=t.call(g,"catchLoc"),k=t.call(g,"finallyLoc");if(j&&k){if(this.prev<g.catchLoc)return d(g.catchLoc,!0);if(this.prev<g.finallyLoc)return d(g.finallyLoc)}else if(!j){if(!k)throw Error("try statement without catch or finally");if(this.prev<g.finallyLoc)return d(g.finallyLoc)}else if(this.prev<g.catchLoc)return d(g.catchLoc,!0)}}},abrupt:function abrupt(b,c){for(var d,e=this.tryEntries.length-1;0<=e;--e)if(d=this.tryEntries[e],d.tryLoc<=this.prev&&t.call(d,"finallyLoc")&&this.prev<d.finallyLoc){var f=d;break}f&&("break"===b||"continue"===b)&&f.tryLoc<=c&&c<=f.finallyLoc&&(f=null);var g=f?f.completion:{};return g.type=b,g.arg=c,f?(this.method="next",this.next=f.finallyLoc,G):this.complete(g)},complete:function complete(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),G},finish:function finish(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.finallyLoc===a)return this.complete(b.completion,b.afterLoc),A(b),G},catch:function _catch(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.tryLoc===a){var d=b.completion;if("throw"===d.type){var f=d.arg;A(b)}return f}throw Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:C(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=D),G}},h}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}var crypto,lname="list_var",ALWAYS_GLOBAL_SET=!0;function add_var(){return _add_var.apply(this,arguments)}function _add_var(){return _add_var=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function d(a,b,c){var e;return _regeneratorRuntime().wrap(function f(d){for(;1;)switch(d.prev=d.next){case 0:return d.next=2,get_var(a,c);case 2:return e=d.sent,Array.isArray(e)||(e=[]),e.push(b),d.next=7,set_var(a,e,c);case 7:return d.abrupt("return",e);case 8:case"end":return d.stop()}},d)})),_add_var.apply(this,arguments)}function get_var_sync(a,b){b||(b={});var c=_core["default"].Global_get(lname,a);if("string"==typeof c&&(c=_optional_dec(c)),b.json&&"string"==typeof c)try{return JSON.parse(c)}catch(a){}return c}function set_var_sync(a,b,c){c||(c={});var d=b;if(c.json&&"function"!=typeof d)try{d=JSON.stringify(d)}catch(a){}return"string"==typeof d&&(d=_optional_enc(d)),_core["default"].Global_set(lname,a,d)}function get_var(a,b){return _get_var.apply(this,arguments)}function _get_var(){return _get_var=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function c(a,b){var d,e,f,g;return _regeneratorRuntime().wrap(function h(c){for(;1;)switch(c.prev=c.next){case 0:return f=function c(){return f=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function c(){var e;return _regeneratorRuntime().wrap(function f(c){for(;1;)switch(c.prev=c.next){case 0:if(e=null,!ALWAYS_GLOBAL_SET&&b&&!b.normal&&(b.local_storage||b.session||b.storage)){c.next=5;break}if(e=_core["default"].Global_get(lname,a),null==e){c.next=5;break}return c.abrupt("return",e);case 5:if(b){c.next=7;break}return c.abrupt("return",void 0);case 7:if(!b.local_storage){c.next=13;break}if(d){c.next=10;break}throw new Error("you cant use localStorage storage in node");case 10:if(e=localStorage[a],null==e){c.next=13;break}return c.abrupt("return",e);case 13:if(!b.session){c.next=19;break}if(d){c.next=16;break}throw new Error("you cant use session storage in node");case 16:if(e=window.sessionStorage.getItem(a),null==e){c.next=19;break}return c.abrupt("return",e);case 19:if(!b.storage){c.next=27;break}if(d){c.next=22;break}throw new Error("you cant use AsyncStorage storage in node");case 22:return c.next=24,_asyncStorage["default"].getItem(a);case 24:if(e=c.sent,null==e){c.next=27;break}return c.abrupt("return",e);case 27:return c.abrupt("return",void 0);case 28:case"end":return c.stop()}},c)})),f.apply(this,arguments)},e=function a(){return f.apply(this,arguments)},b||(b={}),d="undefined"!=typeof window,c.next=6,e();case 6:if(g=c.sent,"string"!=typeof g){c.next=18;break}return c.next=10,_optional_dec(g);case 10:if(g=c.sent,!b.json){c.next=18;break}return c.prev=12,c.abrupt("return",JSON.parse(g));case 16:c.prev=16,c.t0=c["catch"](12);case 18:return c.abrupt("return",g);case 19:case"end":return c.stop()}},c,null,[[12,16]])})),_get_var.apply(this,arguments)}function set_var(a,b,c){return _set_var.apply(this,arguments)}/* -------------------------------------------------------------------------- */ /* if we have crypto support use it, dont throw error otherwise */ /* -------------------------------------------------------------------------- */function _set_var(){return _set_var=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function d(a,b,c){var e,f,g,h,i,j;return _regeneratorRuntime().wrap(function k(d){for(;1;)switch(d.prev=d.next){case 0:/* ----------------------- optionally convert to json ----------------------- */if(c||(c={}),e=b,f="object"===_typeof(e)?e:void 0,g="undefined"!=typeof window,c.json&&null!=e&&"function"!=typeof e)try{e=JSON.stringify(e)}catch(a){}/* -------------------------------------------------------------------------- */if(h="string"==typeof e,h&&(e=_optional_enc(e)),i=null==e||""==e,j=!1,!c.local_storage){d.next=20;break}if(g){d.next=12;break}throw new Error("you cant use localStorage storage in node");case 12:if(!i){d.next=16;break}delete localStorage[a],d.next=19;break;case 16:if(h){d.next=18;break}throw new Error("You cant save non-string values in local_storage !");case 18:localStorage[a]=e;case 19:j=!0;case 20:if(!c.session){d.next=31;break}if(g){d.next=23;break}throw new Error("you cant use session storage in node");case 23:if(!i){d.next=27;break}window.sessionStorage.removeItem(a),d.next=30;break;case 27:if(h){d.next=29;break}throw new Error("You cant save non-string values in session ! "+e);case 29:window.sessionStorage.setItem(a,e);case 30:j=!0;case 31:if(!c.storage){d.next=44;break}if(g){d.next=34;break}throw new Error("you cant use AsyncStorage in node");case 34:if(!i){d.next=39;break}return d.next=37,_asyncStorage["default"].removeItem(a);case 37:d.next=43;break;case 39:if(h){d.next=41;break}throw new Error("You cant save non-string values in AsyncStorage !");case 41:return d.next=43,_asyncStorage["default"].setItem(a,e);case 43:j=!0;case 44:return(ALWAYS_GLOBAL_SET||!j||c.normal)&&_core["default"].Global_set(lname,a,null!==f&&void 0!==f?f:e),d.abrupt("return",e);case 46:case"end":return d.stop()}},d)})),_set_var.apply(this,arguments)}function _optional_dec(a){return crypto?crypto.decrypt(a):a.replaceAll("SECRET","")}function _optional_enc(a){return crypto?crypto.encrypt(a):a+"SECRET"}/* -------------------------------------------------------------------------- */function hold_var(a,b,c){return _react["default"].useEffect(function(){return set_var(a,b,c),function(){set_var(a,null,c)}},[b]),b}