@azrico/global 1.3.69 → 1.3.70
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/package.json +1 -4
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -1
- package/dist/packages/cache/g_cache.d.ts +0 -16
- package/dist/packages/cache/g_cache.js +0 -8
- package/dist/packages/cache/index.d.ts +0 -1
- package/dist/packages/cache/index.js +0 -1
- package/dist/packages/core/index.d.ts +0 -20
- package/dist/packages/core/index.js +0 -7
- package/dist/packages/hooks/g_filter.d.ts +0 -33
- package/dist/packages/hooks/g_filter.js +0 -23
- package/dist/packages/hooks/g_func.d.ts +0 -58
- package/dist/packages/hooks/g_func.js +0 -41
- package/dist/packages/hooks/g_holder.d.ts +0 -7
- package/dist/packages/hooks/g_holder.js +0 -5
- package/dist/packages/hooks/g_view.d.ts +0 -32
- package/dist/packages/hooks/g_view.js +0 -21
- package/dist/packages/hooks/index.d.ts +0 -4
- package/dist/packages/hooks/index.js +0 -1
- package/dist/packages/once/g_once.d.ts +0 -15
- package/dist/packages/once/g_once.js +0 -1
- package/dist/packages/once/index.d.ts +0 -7
- package/dist/packages/once/index.js +0 -1
- package/dist/packages/storage/g_storage.d.ts +0 -13
- package/dist/packages/storage/g_storage.js +0 -1
- package/dist/packages/storage/index.d.ts +0 -1
- package/dist/packages/storage/index.js +0 -1
- package/dist/packages/translation/gtranslate.d.ts +0 -4
- package/dist/packages/translation/gtranslate.js +0 -1
- package/dist/packages/translation/index.d.ts +0 -1
- package/dist/packages/translation/index.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azrico/global",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.70",
|
|
4
4
|
"description": "Simple global functions and helpers",
|
|
5
5
|
"author": "Azrideus",
|
|
6
6
|
"license": "MIT",
|
|
@@ -80,8 +80,5 @@
|
|
|
80
80
|
"peerDependencies": {
|
|
81
81
|
"@react-native-async-storage/async-storage": "^1.15.5",
|
|
82
82
|
"react": "^18.0.0"
|
|
83
|
-
},
|
|
84
|
-
"optionalDependencies": {
|
|
85
|
-
"@azrico/crypto": "^1.0.2"
|
|
86
83
|
}
|
|
87
84
|
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export * as gglobal from "./packages/core";
|
|
2
|
-
export * as gonce from "./packages/once";
|
|
3
|
-
export * as gcache from "./packages/cache";
|
|
4
|
-
export * as gstorage from "./packages/storage";
|
|
5
|
-
export * as gtranslate from "./packages/translation";
|
|
6
|
-
export { gfilter, gfunc, gholder, gview } from "./packages/hooks";
|
package/dist/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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(a,b){if(!b&&a&&a.__esModule)return a;if(null===a||"object"!==_typeof(a)&&"function"!=typeof a)return{default:a};var c=_getRequireWildcardCache(b);if(c&&c.has(a))return c.get(a);var d={},e=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in a)if("default"!=f&&Object.prototype.hasOwnProperty.call(a,f)){var g=e?Object.getOwnPropertyDescriptor(a,f):null;g&&(g.get||g.set)?Object.defineProperty(d,f,g):d[f]=a[f]}return d["default"]=a,c&&c.set(a,d),d}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
type cache_getterFunction<T> = (...params: any) => Promise<T> | T;
|
|
2
|
-
/**
|
|
3
|
-
* set value of a cached key
|
|
4
|
-
* @param key
|
|
5
|
-
* @param value
|
|
6
|
-
* @returns
|
|
7
|
-
*/
|
|
8
|
-
export declare function set_session_cache(key: string, value: any): Promise<any>;
|
|
9
|
-
export declare function delete_session_cache(key: string): Promise<boolean>;
|
|
10
|
-
export declare function get_session_cache(key: string): Promise<any | undefined>;
|
|
11
|
-
export declare function get_session_cache<T>(key: string, getterFunction: cache_getterFunction<T>): Promise<T>;
|
|
12
|
-
export declare function get_temp_cache_sync<T>(key: string, getterFunction?: () => T): T;
|
|
13
|
-
export declare function get_temp_cache<T>(key: string, getterFunction?: () => T | Promise<T>): Promise<T>;
|
|
14
|
-
export declare function set_temp_cache<T>(key: string, value: any): Promise<boolean>;
|
|
15
|
-
export declare function delete_temp_cache<T>(key: string): Promise<boolean>;
|
|
16
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
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 a(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function b(a,b,c,e){var f=b&&b.prototype instanceof d?b:d,g=Object.create(f.prototype),h=new m(e||[]);return s(g,"_invoke",{value:i(a,c,h)}),g}function c(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function d(){}function e(){}function f(){}function g(b){["next","throw","return"].forEach(function(c){a(b,c,function(a){return this._invoke(c,a)})})}function h(a,b){function d(e,f,g,h){var i=c(a[e],a,f);if("throw"!==i.type){var j=i.arg,k=j.value;return k&&"object"==_typeof(k)&&r.call(k,"__await")?b.resolve(k.__await).then(function(a){d("next",a,g,h)},function(a){d("throw",a,g,h)}):b.resolve(k).then(function(a){j.value=a,g(j)},function(a){return d("throw",a,g,h)})}h(i.arg)}var e;s(this,"_invoke",{value:function value(a,c){function f(){return new b(function(b,e){d(a,c,b,e)})}return e=e?e.then(f,f):f()}})}function i(a,b,d){var e="suspendedStart";return function(f,g){if("executing"==e)throw new Error("Generator is already running");if("completed"==e){if("throw"===f)throw g;return o()}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var i=j(h,d);if(i){if(i===x)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=c(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===x)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}function j(a,b){var d=b.method,e=a.iterator[d];if(void 0===e)return b.delegate=null,"throw"===d&&a.iterator["return"]&&(b.method="return",b.arg=void 0,j(a,b),"throw"===b.method)||"return"!==d&&(b.method="throw",b.arg=new TypeError("The iterator does not provide a '"+d+"' method")),x;var f=c(e,a.iterator,b.arg);if("throw"===f.type)return b.method="throw",b.arg=f.arg,b.delegate=null,x;var g=f.arg;return g?g.done?(b[a.resultName]=g.value,b.next=a.nextLoc,"return"!==b.method&&(b.method="next",b.arg=void 0),b.delegate=null,x):g:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,x)}function k(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 l(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function m(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(k,this),this.reset(!0)}function n(a){if(a){var b=a[u];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(r.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=void 0,b.done=!0,b};return d.next=d}}return{next:o}}function o(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return p};var p={},q=Object.prototype,r=q.hasOwnProperty,s=Object.defineProperty||function(a,b,c){a[b]=c.value},t="function"==typeof Symbol?Symbol:{},u=t.iterator||"@@iterator",v=t.asyncIterator||"@@asyncIterator",w=t.toStringTag||"@@toStringTag";try{a({},"")}catch(b){a=function(a,b,c){return a[b]=c}}p.wrap=b;var x={},y={};a(y,u,function(){return this});var z=Object.getPrototypeOf,A=z&&z(z(n([])));A&&A!==q&&r.call(A,u)&&(y=A);var B=f.prototype=d.prototype=Object.create(y);return e.prototype=f,s(B,"constructor",{value:f,configurable:!0}),s(f,"constructor",{value:e,configurable:!0}),e.displayName=a(f,w,"GeneratorFunction"),p.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===e||"GeneratorFunction"===(b.displayName||b.name))},p.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,f):(b.__proto__=f,a(b,w,"GeneratorFunction")),b.prototype=Object.create(B),b},p.awrap=function(a){return{__await:a}},g(h.prototype),a(h.prototype,v,function(){return this}),p.AsyncIterator=h,p.async=function(a,c,d,e,f){void 0===f&&(f=Promise);var g=new h(b(a,c,d,e),f);return p.isGeneratorFunction(c)?g:g.next().then(function(a){return a.done?a.value:g.next()})},g(B),a(B,w,"Generator"),a(B,u,function(){return this}),a(B,"toString",function(){return"[object Generator]"}),p.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}},p.values=n,m.prototype={constructor:m,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(l),!a)for(var b in this)"t"===b.charAt(0)&&r.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=void 0)},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(a){function b(b,d){return f.type="throw",f.arg=a,c.next=b,d&&(c.method="next",c.arg=void 0),!!d}if(this.done)throw a;for(var c=this,d=this.tryEntries.length-1;0<=d;--d){var e=this.tryEntries[d],f=e.completion;if("root"===e.tryLoc)return b("end");if(e.tryLoc<=this.prev){var g=r.call(e,"catchLoc"),h=r.call(e,"finallyLoc");if(g&&h){if(this.prev<e.catchLoc)return b(e.catchLoc,!0);if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(!g){if(!h)throw new Error("try statement without catch or finally");if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(this.prev<e.catchLoc)return b(e.catchLoc,!0)}}},abrupt:function abrupt(a,b){for(var c,d=this.tryEntries.length-1;0<=d;--d)if(c=this.tryEntries[d],c.tryLoc<=this.prev&&r.call(c,"finallyLoc")&&this.prev<c.finallyLoc){var e=c;break}e&&("break"===a||"continue"===a)&&e.tryLoc<=b&&b<=e.finallyLoc&&(e=null);var f=e?e.completion:{};return f.type=a,f.arg=b,e?(this.method="next",this.next=e.finallyLoc,x):this.complete(f)},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),x},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),l(b),x},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 e=d.arg;l(b)}return e}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:n(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=void 0),x}},p}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)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){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
|
|
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}}]),a}();/* -------------------------------------------------------------------------- */ /**
|
|
4
|
-
* set value of a cached key
|
|
5
|
-
* @param key
|
|
6
|
-
* @param value
|
|
7
|
-
* @returns
|
|
8
|
-
*/function set_session_cache(a,b){return _set_session_cache.apply(this,arguments)}function _set_session_cache(){return _set_session_cache=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function c(a,b){return _regeneratorRuntime().wrap(function d(c){for(;1;)switch(c.prev=c.next){case 0:return c.next=2,GCache.set_cache(a,b);case 2:return c.abrupt("return",c.sent);case 3:case"end":return c.stop();}},c)})),_set_session_cache.apply(this,arguments)}function delete_session_cache(a){return _delete_session_cache.apply(this,arguments)}function _delete_session_cache(){return _delete_session_cache=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){return _regeneratorRuntime().wrap(function c(b){for(;1;)switch(b.prev=b.next){case 0:return b.next=2,GCache.delete_cache(a,!0);case 2:return b.abrupt("return",b.sent);case 3:case"end":return b.stop();}},b)})),_delete_session_cache.apply(this,arguments)}function get_session_cache(a,b){return _get_session_cache.apply(this,arguments)}/* -------------------------------------------------------------------------- */ /* TEMP CACHE */ /* -------------------------------------------------------------------------- */function _get_session_cache(){return _get_session_cache=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function c(a,b){return _regeneratorRuntime().wrap(function d(c){for(;1;)switch(c.prev=c.next){case 0:return c.next=2,GCache.get_cache(a,b,!0);case 2:return c.abrupt("return",c.sent);case 3:case"end":return c.stop();}},c)})),_get_session_cache.apply(this,arguments)}function get_temp_cache_sync(a,b){return GCache.get_cache_sync(a,b)}function get_temp_cache(a,b){return _get_temp_cache.apply(this,arguments)}function _get_temp_cache(){return _get_temp_cache=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function c(a,b){return _regeneratorRuntime().wrap(function d(c){for(;1;)switch(c.prev=c.next){case 0:return c.next=2,GCache.get_cache(a,b,!1);case 2:return c.abrupt("return",c.sent);case 3:case"end":return c.stop();}},c)})),_get_temp_cache.apply(this,arguments)}function set_temp_cache(a,b){return _set_temp_cache.apply(this,arguments)}function _set_temp_cache(){return _set_temp_cache=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function c(a,b){return _regeneratorRuntime().wrap(function d(c){for(;1;)switch(c.prev=c.next){case 0:return c.next=2,GCache.set_cache(a,b,!1);case 2:return c.abrupt("return",c.sent);case 3:case"end":return c.stop();}},c)})),_set_temp_cache.apply(this,arguments)}function delete_temp_cache(a){return _delete_temp_cache.apply(this,arguments)}/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */function _delete_temp_cache(){return _delete_temp_cache=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){return _regeneratorRuntime().wrap(function c(b){for(;1;)switch(b.prev=b.next){case 0:return b.next=2,GCache.delete_cache(a,!1);case 2:return b.abrupt("return",b.sent);case 3:case"end":return b.stop();}},b)})),_delete_temp_cache.apply(this,arguments)}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./g_cache";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var _g_cache=require("./g_cache");Object.defineProperty(exports,"__esModule",{value:!0});Object.keys(_g_cache).forEach(function(a){"default"===a||"__esModule"===a||a in exports&&exports[a]===_g_cache[a]||Object.defineProperty(exports,a,{enumerable:!0,get:function get(){return _g_cache[a]}})});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
type glbKey = string | true;
|
|
2
|
-
export declare class GlobalStorage {
|
|
3
|
-
static deus_globals: any;
|
|
4
|
-
static initGlobal(): false | undefined;
|
|
5
|
-
static Global_set<T>(type: string, key: glbKey, value: T): T;
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
* @param type
|
|
9
|
-
* @param key
|
|
10
|
-
* @param value
|
|
11
|
-
* @returns total number of elements in targeted glb array
|
|
12
|
-
*/
|
|
13
|
-
static Global_add(type: string, key: glbKey, value: any): number;
|
|
14
|
-
static Global_remove(type: string, key: glbKey, value: any): any;
|
|
15
|
-
static Global_get(type: string, key: glbKey): any;
|
|
16
|
-
static fixKey(key: boolean): boolean;
|
|
17
|
-
static fixKey(key: string | string[]): string;
|
|
18
|
-
static prepareGlobalsOfType(type: string): boolean;
|
|
19
|
-
}
|
|
20
|
-
export default GlobalStorage;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=exports.GlobalStorage=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 _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 _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){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 GlobalStorage=/*#__PURE__*/function(){function a(){_classCallCheck(this,a)}return _createClass(a,null,[{key:"initGlobal",value:function initGlobal(){return null!=a&&void(null==a.deus_globals&&(a.deus_globals={}))}/* -------------------------------------------------------------------------- */},{key:"Global_set",value:function Global_set(b,c,d){return a.prepareGlobalsOfType(b),!0===c?(null==d?delete a.deus_globals[b]:a.deus_globals[b]=d,a.deus_globals[b]=d):(c=a.fixKey(c),null==d?delete a.deus_globals[b][c]:a.deus_globals[b][c]=d),d}/**
|
|
2
|
-
*
|
|
3
|
-
* @param type
|
|
4
|
-
* @param key
|
|
5
|
-
* @param value
|
|
6
|
-
* @returns total number of elements in targeted glb array
|
|
7
|
-
*/},{key:"Global_add",value:function Global_add(b,c,d){if("string"!=typeof c)throw new Error("Key was not a string");c=a.fixKey(c),a.prepareGlobalsOfType(b);var e=a.deus_globals[b][c];return null!=e&&Array.isArray(e)||(null==e?e=[]:e=[e]),e.push(d),a.Global_set(b,c,e),e.length}},{key:"Global_remove",value:function Global_remove(b,c,d){if("string"!=typeof c)throw new Error("Key was not a string");a.prepareGlobalsOfType(b),c=a.fixKey(c);var e=a.deus_globals[b][c];if(null==e&&(e=[]),!Array.isArray(e))return console.warn("Targeted global was not array ".concat(c)),!1;var f=e.filter(function(a){return a!==d});return a.Global_set(b,c,f)}},{key:"Global_get",value:function Global_get(b,c){var d;if(a.deus_globals)return"boolean"==typeof c?a.deus_globals[b]:(c=a.fixKey(c),null===(d=a.deus_globals[b])||void 0===d?void 0:d[c])}},{key:"fixKey",value:function fixKey(a){return"boolean"==typeof a?a:((Array.isArray(a)?a.join("-"):a)+"").toLowerCase().replace(" ","_")}},{key:"prepareGlobalsOfType",value:function prepareGlobalsOfType(b){return null==a.deus_globals[b]&&(a.deus_globals[b]={}),!0}}]),a}();exports.GlobalStorage=GlobalStorage,_defineProperty(GlobalStorage,"deus_globals",{});var _default=GlobalStorage;exports["default"]=_default;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Adds a filter
|
|
3
|
-
* @param key
|
|
4
|
-
* @param action action of the filter
|
|
5
|
-
* @param priority filters with lower priority are executed first
|
|
6
|
-
* @returns
|
|
7
|
-
*/
|
|
8
|
-
export declare function add_filter(key: string, action: Function, priority?: number): any;
|
|
9
|
-
export declare function remove_filter(key: string, action: Function): any;
|
|
10
|
-
export declare function clear_filter(key: string): any;
|
|
11
|
-
export declare function clear_all_filters(): any;
|
|
12
|
-
/**
|
|
13
|
-
* Apply a filter asynchronously
|
|
14
|
-
* @param key
|
|
15
|
-
* @param initialValue
|
|
16
|
-
* @returns
|
|
17
|
-
*/
|
|
18
|
-
export declare function apply_filter(key: string, initialValue?: any): Promise<any>;
|
|
19
|
-
/**
|
|
20
|
-
* Apply a filter synchronously
|
|
21
|
-
* @param key
|
|
22
|
-
* @param initialValue
|
|
23
|
-
* @returns
|
|
24
|
-
*/
|
|
25
|
-
export declare function apply_filter_sync(key: string, initialValue?: any): any;
|
|
26
|
-
/**
|
|
27
|
-
* Adds a filter until the current component unmounts
|
|
28
|
-
* @param key
|
|
29
|
-
* @param action
|
|
30
|
-
* @param priority
|
|
31
|
-
* @returns
|
|
32
|
-
*/
|
|
33
|
-
export declare function hold_add_filter(key: string, action: (...args: any[]) => any, priority?: number): any;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.add_filter=add_filter,exports.apply_filter=apply_filter,exports.apply_filter_sync=apply_filter_sync,exports.clear_all_filters=clear_all_filters,exports.clear_filter=clear_filter,exports.hold_add_filter=hold_add_filter,exports.remove_filter=remove_filter;var _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 a(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function b(a,b,c,e){var f=b&&b.prototype instanceof d?b:d,g=Object.create(f.prototype),h=new m(e||[]);return s(g,"_invoke",{value:i(a,c,h)}),g}function c(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function d(){}function e(){}function f(){}function g(b){["next","throw","return"].forEach(function(c){a(b,c,function(a){return this._invoke(c,a)})})}function h(a,b){function d(e,f,g,h){var i=c(a[e],a,f);if("throw"!==i.type){var j=i.arg,k=j.value;return k&&"object"==_typeof(k)&&r.call(k,"__await")?b.resolve(k.__await).then(function(a){d("next",a,g,h)},function(a){d("throw",a,g,h)}):b.resolve(k).then(function(a){j.value=a,g(j)},function(a){return d("throw",a,g,h)})}h(i.arg)}var e;s(this,"_invoke",{value:function value(a,c){function f(){return new b(function(b,e){d(a,c,b,e)})}return e=e?e.then(f,f):f()}})}function i(a,b,d){var e="suspendedStart";return function(f,g){if("executing"==e)throw new Error("Generator is already running");if("completed"==e){if("throw"===f)throw g;return o()}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var i=j(h,d);if(i){if(i===x)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=c(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===x)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}function j(a,b){var d=b.method,e=a.iterator[d];if(void 0===e)return b.delegate=null,"throw"===d&&a.iterator["return"]&&(b.method="return",b.arg=void 0,j(a,b),"throw"===b.method)||"return"!==d&&(b.method="throw",b.arg=new TypeError("The iterator does not provide a '"+d+"' method")),x;var f=c(e,a.iterator,b.arg);if("throw"===f.type)return b.method="throw",b.arg=f.arg,b.delegate=null,x;var g=f.arg;return g?g.done?(b[a.resultName]=g.value,b.next=a.nextLoc,"return"!==b.method&&(b.method="next",b.arg=void 0),b.delegate=null,x):g:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,x)}function k(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 l(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function m(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(k,this),this.reset(!0)}function n(a){if(a){var b=a[u];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(r.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=void 0,b.done=!0,b};return d.next=d}}return{next:o}}function o(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return p};var p={},q=Object.prototype,r=q.hasOwnProperty,s=Object.defineProperty||function(a,b,c){a[b]=c.value},t="function"==typeof Symbol?Symbol:{},u=t.iterator||"@@iterator",v=t.asyncIterator||"@@asyncIterator",w=t.toStringTag||"@@toStringTag";try{a({},"")}catch(b){a=function(a,b,c){return a[b]=c}}p.wrap=b;var x={},y={};a(y,u,function(){return this});var z=Object.getPrototypeOf,A=z&&z(z(n([])));A&&A!==q&&r.call(A,u)&&(y=A);var B=f.prototype=d.prototype=Object.create(y);return e.prototype=f,s(B,"constructor",{value:f,configurable:!0}),s(f,"constructor",{value:e,configurable:!0}),e.displayName=a(f,w,"GeneratorFunction"),p.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===e||"GeneratorFunction"===(b.displayName||b.name))},p.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,f):(b.__proto__=f,a(b,w,"GeneratorFunction")),b.prototype=Object.create(B),b},p.awrap=function(a){return{__await:a}},g(h.prototype),a(h.prototype,v,function(){return this}),p.AsyncIterator=h,p.async=function(a,c,d,e,f){void 0===f&&(f=Promise);var g=new h(b(a,c,d,e),f);return p.isGeneratorFunction(c)?g:g.next().then(function(a){return a.done?a.value:g.next()})},g(B),a(B,w,"Generator"),a(B,u,function(){return this}),a(B,"toString",function(){return"[object Generator]"}),p.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}},p.values=n,m.prototype={constructor:m,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(l),!a)for(var b in this)"t"===b.charAt(0)&&r.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=void 0)},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(a){function b(b,d){return f.type="throw",f.arg=a,c.next=b,d&&(c.method="next",c.arg=void 0),!!d}if(this.done)throw a;for(var c=this,d=this.tryEntries.length-1;0<=d;--d){var e=this.tryEntries[d],f=e.completion;if("root"===e.tryLoc)return b("end");if(e.tryLoc<=this.prev){var g=r.call(e,"catchLoc"),h=r.call(e,"finallyLoc");if(g&&h){if(this.prev<e.catchLoc)return b(e.catchLoc,!0);if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(!g){if(!h)throw new Error("try statement without catch or finally");if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(this.prev<e.catchLoc)return b(e.catchLoc,!0)}}},abrupt:function abrupt(a,b){for(var c,d=this.tryEntries.length-1;0<=d;--d)if(c=this.tryEntries[d],c.tryLoc<=this.prev&&r.call(c,"finallyLoc")&&this.prev<c.finallyLoc){var e=c;break}e&&("break"===a||"continue"===a)&&e.tryLoc<=b&&b<=e.finallyLoc&&(e=null);var f=e?e.completion:{};return f.type=a,f.arg=b,e?(this.method="next",this.next=e.finallyLoc,x):this.complete(f)},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),x},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),l(b),x},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 e=d.arg;l(b)}return e}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:n(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=void 0),x}},p}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)})}}/* -------------------------------------------------------------------------- */ /* Filters */ /* -------------------------------------------------------------------------- */var lname_filter="list_filter";/**
|
|
2
|
-
* Adds a filter
|
|
3
|
-
* @param key
|
|
4
|
-
* @param action action of the filter
|
|
5
|
-
* @param priority filters with lower priority are executed first
|
|
6
|
-
* @returns
|
|
7
|
-
*/function add_filter(a,b){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:10;return _core["default"].Global_add(lname_filter,a,{key:a,action:b,priority: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)}/**
|
|
8
|
-
* Apply a filter asynchronously
|
|
9
|
-
* @param key
|
|
10
|
-
* @param initialValue
|
|
11
|
-
* @returns
|
|
12
|
-
*/function apply_filter(){return _apply_filter.apply(this,arguments)}/**
|
|
13
|
-
* Apply a filter synchronously
|
|
14
|
-
* @param key
|
|
15
|
-
* @param initialValue
|
|
16
|
-
* @returns
|
|
17
|
-
*/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});for(var d=b,e=0;e<c.length;e++){var f=c[e],g=f.action(d);g!==void 0&&(d=g)}return d}/* -------------------------------------------------------------------------- */ /**
|
|
18
|
-
* Adds a filter until the current component unmounts
|
|
19
|
-
* @param key
|
|
20
|
-
* @param action
|
|
21
|
-
* @param priority
|
|
22
|
-
* @returns
|
|
23
|
-
*/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)}},[])}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
export type actionFunction = ((...args: any[]) => any | Promise<any>) | (() => any | Promise<any>);
|
|
2
|
-
export declare function get_action(key: string): Array<actionFunction> | actionFunction | null;
|
|
3
|
-
/**
|
|
4
|
-
* set action in action list by its key , you can later run this action using the key
|
|
5
|
-
* @param key
|
|
6
|
-
* @param value
|
|
7
|
-
* @returns
|
|
8
|
-
*/
|
|
9
|
-
export declare function set_action(key: string, func: actionFunction | null): any;
|
|
10
|
-
/**
|
|
11
|
-
* Adds an action to action list, you can later run those actions
|
|
12
|
-
* @param key
|
|
13
|
-
* @param value
|
|
14
|
-
* @returns
|
|
15
|
-
*/
|
|
16
|
-
export declare function add_action(key: string, func: actionFunction): any;
|
|
17
|
-
/**
|
|
18
|
-
* remove an action from action list
|
|
19
|
-
* @param key
|
|
20
|
-
* @param value
|
|
21
|
-
* @returns
|
|
22
|
-
*/
|
|
23
|
-
export declare function remove_action(key: string, value: actionFunction): any;
|
|
24
|
-
/**
|
|
25
|
-
* Runs an action or a list of actions by their key, then clear the action list
|
|
26
|
-
* @param key
|
|
27
|
-
* @param args
|
|
28
|
-
* @returns result of action if there is a single action , or an array of results if there are multiple actions
|
|
29
|
-
*/
|
|
30
|
-
export declare function run_action_clear(key: string, ...args: any[]): Promise<any>;
|
|
31
|
-
/**
|
|
32
|
-
* Runs an action or a list of actions by their key,
|
|
33
|
-
* @param key
|
|
34
|
-
* @param args
|
|
35
|
-
* @returns result of action if there is a single action , or an array of results if there are multiple actions
|
|
36
|
-
*/
|
|
37
|
-
export declare function run_action(key: string, ...args: any[]): Promise<any>;
|
|
38
|
-
/**
|
|
39
|
-
* Runs an action or a list of actions by their key,
|
|
40
|
-
* @param key
|
|
41
|
-
* @param args
|
|
42
|
-
* @returns result of action if there is a single action , or an array of results if there are multiple actions
|
|
43
|
-
*/
|
|
44
|
-
export declare function run_action_sync(key: string, ...args: any[]): any;
|
|
45
|
-
/**
|
|
46
|
-
* Adds an action until the current component unmounts
|
|
47
|
-
* @param key
|
|
48
|
-
* @param value
|
|
49
|
-
* @returns
|
|
50
|
-
*/
|
|
51
|
-
export declare function hold_add_action(key: string, func: actionFunction): any;
|
|
52
|
-
/**
|
|
53
|
-
* set an action until the current component unmounts
|
|
54
|
-
* @param key
|
|
55
|
-
* @param value
|
|
56
|
-
* @returns
|
|
57
|
-
*/
|
|
58
|
-
export declare function hold_set_action(key: string, func: actionFunction): any;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.add_action=add_action,exports.get_action=get_action,exports.hold_add_action=hold_add_action,exports.hold_set_action=hold_set_action,exports.remove_action=remove_action,exports.run_action=run_action,exports.run_action_clear=run_action_clear,exports.run_action_sync=run_action_sync,exports.set_action=set_action;var _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 a(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function b(a,b,c,e){var f=b&&b.prototype instanceof d?b:d,g=Object.create(f.prototype),h=new m(e||[]);return s(g,"_invoke",{value:i(a,c,h)}),g}function c(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function d(){}function e(){}function f(){}function g(b){["next","throw","return"].forEach(function(c){a(b,c,function(a){return this._invoke(c,a)})})}function h(a,b){function d(e,f,g,h){var i=c(a[e],a,f);if("throw"!==i.type){var j=i.arg,k=j.value;return k&&"object"==_typeof(k)&&r.call(k,"__await")?b.resolve(k.__await).then(function(a){d("next",a,g,h)},function(a){d("throw",a,g,h)}):b.resolve(k).then(function(a){j.value=a,g(j)},function(a){return d("throw",a,g,h)})}h(i.arg)}var e;s(this,"_invoke",{value:function value(a,c){function f(){return new b(function(b,e){d(a,c,b,e)})}return e=e?e.then(f,f):f()}})}function i(a,b,d){var e="suspendedStart";return function(f,g){if("executing"==e)throw new Error("Generator is already running");if("completed"==e){if("throw"===f)throw g;return o()}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var i=j(h,d);if(i){if(i===x)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=c(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===x)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}function j(a,b){var d=b.method,e=a.iterator[d];if(void 0===e)return b.delegate=null,"throw"===d&&a.iterator["return"]&&(b.method="return",b.arg=void 0,j(a,b),"throw"===b.method)||"return"!==d&&(b.method="throw",b.arg=new TypeError("The iterator does not provide a '"+d+"' method")),x;var f=c(e,a.iterator,b.arg);if("throw"===f.type)return b.method="throw",b.arg=f.arg,b.delegate=null,x;var g=f.arg;return g?g.done?(b[a.resultName]=g.value,b.next=a.nextLoc,"return"!==b.method&&(b.method="next",b.arg=void 0),b.delegate=null,x):g:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,x)}function k(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 l(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function m(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(k,this),this.reset(!0)}function n(a){if(a){var b=a[u];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(r.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=void 0,b.done=!0,b};return d.next=d}}return{next:o}}function o(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return p};var p={},q=Object.prototype,r=q.hasOwnProperty,s=Object.defineProperty||function(a,b,c){a[b]=c.value},t="function"==typeof Symbol?Symbol:{},u=t.iterator||"@@iterator",v=t.asyncIterator||"@@asyncIterator",w=t.toStringTag||"@@toStringTag";try{a({},"")}catch(b){a=function(a,b,c){return a[b]=c}}p.wrap=b;var x={},y={};a(y,u,function(){return this});var z=Object.getPrototypeOf,A=z&&z(z(n([])));A&&A!==q&&r.call(A,u)&&(y=A);var B=f.prototype=d.prototype=Object.create(y);return e.prototype=f,s(B,"constructor",{value:f,configurable:!0}),s(f,"constructor",{value:e,configurable:!0}),e.displayName=a(f,w,"GeneratorFunction"),p.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===e||"GeneratorFunction"===(b.displayName||b.name))},p.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,f):(b.__proto__=f,a(b,w,"GeneratorFunction")),b.prototype=Object.create(B),b},p.awrap=function(a){return{__await:a}},g(h.prototype),a(h.prototype,v,function(){return this}),p.AsyncIterator=h,p.async=function(a,c,d,e,f){void 0===f&&(f=Promise);var g=new h(b(a,c,d,e),f);return p.isGeneratorFunction(c)?g:g.next().then(function(a){return a.done?a.value:g.next()})},g(B),a(B,w,"Generator"),a(B,u,function(){return this}),a(B,"toString",function(){return"[object Generator]"}),p.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}},p.values=n,m.prototype={constructor:m,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(l),!a)for(var b in this)"t"===b.charAt(0)&&r.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=void 0)},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(a){function b(b,d){return f.type="throw",f.arg=a,c.next=b,d&&(c.method="next",c.arg=void 0),!!d}if(this.done)throw a;for(var c=this,d=this.tryEntries.length-1;0<=d;--d){var e=this.tryEntries[d],f=e.completion;if("root"===e.tryLoc)return b("end");if(e.tryLoc<=this.prev){var g=r.call(e,"catchLoc"),h=r.call(e,"finallyLoc");if(g&&h){if(this.prev<e.catchLoc)return b(e.catchLoc,!0);if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(!g){if(!h)throw new Error("try statement without catch or finally");if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(this.prev<e.catchLoc)return b(e.catchLoc,!0)}}},abrupt:function abrupt(a,b){for(var c,d=this.tryEntries.length-1;0<=d;--d)if(c=this.tryEntries[d],c.tryLoc<=this.prev&&r.call(c,"finallyLoc")&&this.prev<c.finallyLoc){var e=c;break}e&&("break"===a||"continue"===a)&&e.tryLoc<=b&&b<=e.finallyLoc&&(e=null);var f=e?e.completion:{};return f.type=a,f.arg=b,e?(this.method="next",this.next=e.finallyLoc,x):this.complete(f)},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),x},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),l(b),x},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 e=d.arg;l(b)}return e}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:n(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=void 0),x}},p}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 lname="list_func";/* -------------------------------------------------------------------------- */function get_action(a){var b=_core["default"].Global_get(lname,a);return Array.isArray(b)||"function"==typeof b?b:null}/**
|
|
2
|
-
* set action in action list by its key , you can later run this action using the key
|
|
3
|
-
* @param key
|
|
4
|
-
* @param value
|
|
5
|
-
* @returns
|
|
6
|
-
*/function set_action(a,b){return _core["default"].Global_set(lname,a,b)}/**
|
|
7
|
-
* Adds an action to action list, you can later run those actions
|
|
8
|
-
* @param key
|
|
9
|
-
* @param value
|
|
10
|
-
* @returns
|
|
11
|
-
*/function add_action(a,b){return _core["default"].Global_add(lname,a,b)}/**
|
|
12
|
-
* remove an action from action list
|
|
13
|
-
* @param key
|
|
14
|
-
* @param value
|
|
15
|
-
* @returns
|
|
16
|
-
*/function remove_action(a,b){return _core["default"].Global_remove(lname,a,b)}/**
|
|
17
|
-
* Runs an action or a list of actions by their key, then clear the action list
|
|
18
|
-
* @param key
|
|
19
|
-
* @param args
|
|
20
|
-
* @returns result of action if there is a single action , or an array of results if there are multiple actions
|
|
21
|
-
*/function run_action_clear(){return _run_action_clear.apply(this,arguments)}/**
|
|
22
|
-
* Runs an action or a list of actions by their key,
|
|
23
|
-
* @param key
|
|
24
|
-
* @param args
|
|
25
|
-
* @returns result of action if there is a single action , or an array of results if there are multiple actions
|
|
26
|
-
*/function _run_action_clear(){return _run_action_clear=_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:for(c=g.length,d=Array(1<c?c-1:0),e=1;e<c;e++)d[e-1]=g[e];return b.next=3,run_action.apply(void 0,[a].concat(d));case 3:return f=b.sent,set_action(a,null),b.abrupt("return",f);case 6:case"end":return b.stop();}},b)})),_run_action_clear.apply(this,arguments)}function run_action(a){return _run_action.apply(this,arguments)}/**
|
|
27
|
-
* Runs an action or a list of actions by their key,
|
|
28
|
-
* @param key
|
|
29
|
-
* @param args
|
|
30
|
-
* @returns result of action if there is a single action , or an array of results if there are multiple actions
|
|
31
|
-
*/function _run_action(){return _run_action=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){var c,d,e,f,g,h,i,j,k,l=arguments;return _regeneratorRuntime().wrap(function m(b){for(;1;)switch(b.prev=b.next){case 0:if(c=get_action(a),null!=c){b.next=3;break}return b.abrupt("return",null);case 3:for(d=l.length,e=Array(1<d?d-1:0),f=1;f<d;f++)e[f-1]=l[f];if("function"!=typeof c){b.next=9;break}return g=c,b.next=8,g.apply(void 0,e);case 8:return b.abrupt("return",b.sent);case 9:if(!Array.isArray(c)){b.next=29;break}h=[],i=0;case 12:if(!(i<c.length)){b.next=26;break}if(j=c[i],"function"!=typeof j){b.next=22;break}return k=null,b.next=18,j.apply(void 0,e);case 18:k=b.sent,h.push(k),b.next=23;break;case 22:console.error("[run_action]","non function detected ","key:",a);case 23:i++,b.next=12;break;case 26:return b.abrupt("return",h);case 29:console.error("[run_action]","invalid functions detected ","key:",a);case 30:case"end":return b.stop();}},b)})),_run_action.apply(this,arguments)}function run_action_sync(a){var b=get_action(a);if(null==b)return null;for(var c=arguments.length,d=Array(1<c?c-1:0),e=1;e<c;e++)d[e-1]=arguments[e];if("function"==typeof b){var f=b;return f.apply(void 0,d)}if(Array.isArray(b)){for(var g,h=[],i=0;i<b.length;i++)if(g=b[i],"function"==typeof g){var j=null;j=g.apply(void 0,d),h.push(j)}else console.error("[run_action]","non function detected ","key:",a);return h}console.error("[run_action]","invalid functions detected ","key:",a)}/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ /**
|
|
32
|
-
* Adds an action until the current component unmounts
|
|
33
|
-
* @param key
|
|
34
|
-
* @param value
|
|
35
|
-
* @returns
|
|
36
|
-
*/function hold_add_action(a,b){var c=_react["default"].useCallback(b,[]);_react["default"].useEffect(function(){return add_action(a,c),function(){return remove_action(a,c)}},[])}/**
|
|
37
|
-
* set an action until the current component unmounts
|
|
38
|
-
* @param key
|
|
39
|
-
* @param value
|
|
40
|
-
* @returns
|
|
41
|
-
*/function hold_set_action(a,b){var c=_react["default"].useCallback(b,[]);_react["default"].useEffect(function(){return set_action(a,c),function(){return set_action(a,null)}},[])}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Holds a key until the current component unmounts
|
|
3
|
-
* you can use this to see if a certain component is alive or not
|
|
4
|
-
* @param key
|
|
5
|
-
*/
|
|
6
|
-
export declare function hold_key(key: string, value?: string, isActive?: boolean): any;
|
|
7
|
-
export declare function is_key_held(key: string): any;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.hold_key=hold_key,exports.is_key_held=is_key_held;var _react=_interopRequireDefault(require("react")),_core=_interopRequireDefault(require("../core"));function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}var lname_hold="list_hold_keys";/**
|
|
2
|
-
* Holds a key until the current component unmounts
|
|
3
|
-
* you can use this to see if a certain component is alive or not
|
|
4
|
-
* @param key
|
|
5
|
-
*/function hold_key(a){var b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:"",c=!(2<arguments.length&&arguments[2]!==void 0)||arguments[2],d=_react["default"].useMemo(function(){return Symbol(b)},[]);_react["default"].useEffect(function(){var b=a;return c?_core["default"].Global_add(lname_hold,b,d):_core["default"].Global_remove(lname_hold,b,d),function(){return _core["default"].Global_remove(lname_hold,b,d)}},[c])}function is_key_held(a){var b=_core["default"].Global_get(lname_hold,a);return Array.isArray(b)&&0<b.length}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
type viewType = React.ReactNode | ((props: any) => React.ReactNode);
|
|
3
|
-
/**
|
|
4
|
-
* Adds a view to view list
|
|
5
|
-
* @param key
|
|
6
|
-
* @param action action of the filter
|
|
7
|
-
* @param priority filters with lower priority are executed first
|
|
8
|
-
* @returns
|
|
9
|
-
*/
|
|
10
|
-
export declare function add_view(key: string, view: viewType, priority?: number): any;
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
* @param view_key
|
|
14
|
-
* @param initialValue
|
|
15
|
-
* @returns
|
|
16
|
-
*/
|
|
17
|
-
export declare function load_views(view_key: string, initialValue?: viewType, child_props?: any): viewType | undefined;
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
* @param view_key
|
|
21
|
-
* @param initialValue
|
|
22
|
-
* @returns
|
|
23
|
-
*/
|
|
24
|
-
export declare function use_views(view_key: string, initialValue?: viewType, child_props?: any): any;
|
|
25
|
-
interface ViewsContainerProps {
|
|
26
|
-
view_key: string;
|
|
27
|
-
initialValue?: viewType;
|
|
28
|
-
children?: React.ReactNode;
|
|
29
|
-
children_props?: any;
|
|
30
|
-
}
|
|
31
|
-
export declare function ViewsContainer(props: ViewsContainerProps): JSX.Element;
|
|
32
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ViewsContainer=ViewsContainer,exports.add_view=add_view,exports.load_views=load_views,exports.use_views=use_views;var _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 ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){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)}/* -------------------------------------------------------------------------- */ /* Filters */ /* -------------------------------------------------------------------------- */var lname_views="list_views";/**
|
|
2
|
-
* Adds a view to view list
|
|
3
|
-
* @param key
|
|
4
|
-
* @param action action of the filter
|
|
5
|
-
* @param priority filters with lower priority are executed first
|
|
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};
|
|
9
|
-
// return glb.Global_add(lname_filter, key, view);
|
|
10
|
-
// }
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
* @param view_key
|
|
14
|
-
* @param initialValue
|
|
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}/**
|
|
17
|
-
*
|
|
18
|
-
* @param view_key
|
|
19
|
-
* @param initialValue
|
|
20
|
-
* @returns
|
|
21
|
-
*/function use_views(a,b,c){return _react["default"].useMemo(function(){return load_views(a,b,c)},[])}function ViewsContainer(a){var b=use_views(a.view_key,a.initialValue,a.children_props);return _react["default"].createElement("div",null,a.children,b)}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var _gfunc=_interopRequireWildcard(require("./g_func"));var _gfilter=_interopRequireWildcard(require("./g_filter"));var _gview=_interopRequireWildcard(require("./g_view"));var _gholder=_interopRequireWildcard(require("./g_holder"));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.gview=exports.gholder=exports.gfunc=exports.gfilter=void 0;exports.gfunc=_gfunc;exports.gfilter=_gfilter;exports.gview=_gview;exports.gholder=_gholder;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(a,b){if(!b&&a&&a.__esModule)return a;if(null===a||"object"!==_typeof(a)&&"function"!=typeof a)return{default:a};var c=_getRequireWildcardCache(b);if(c&&c.has(a))return c.get(a);var d={},e=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in a)if("default"!=f&&Object.prototype.hasOwnProperty.call(a,f)){var g=e?Object.getOwnPropertyDescriptor(a,f):null;g&&(g.get||g.set)?Object.defineProperty(d,f,g):d[f]=a[f]}return d["default"]=a,c&&c.set(a,d),d}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Runs the specefic function only once
|
|
3
|
-
* @param key
|
|
4
|
-
* @param f
|
|
5
|
-
* @returns
|
|
6
|
-
*/
|
|
7
|
-
export declare function do_once(f: Function): Promise<any>;
|
|
8
|
-
/**
|
|
9
|
-
* Runs the specefic function only once
|
|
10
|
-
* @param key
|
|
11
|
-
* @param f
|
|
12
|
-
* @returns
|
|
13
|
-
*/
|
|
14
|
-
export declare function do_once(f: Function, key: string, ifNot?: Function): Promise<any>;
|
|
15
|
-
export declare function reset_once(key?: any): any;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var _core=_interopRequireDefault(require("../core"));Object.defineProperty(exports,"__esModule",{value:!0}),exports.do_once=do_once,exports.reset_once=reset_once;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 a(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function b(a,b,c,e){var f=b&&b.prototype instanceof d?b:d,g=Object.create(f.prototype),h=new m(e||[]);return s(g,"_invoke",{value:i(a,c,h)}),g}function c(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function d(){}function e(){}function f(){}function g(b){["next","throw","return"].forEach(function(c){a(b,c,function(a){return this._invoke(c,a)})})}function h(a,b){function d(e,f,g,h){var i=c(a[e],a,f);if("throw"!==i.type){var j=i.arg,k=j.value;return k&&"object"==_typeof(k)&&r.call(k,"__await")?b.resolve(k.__await).then(function(a){d("next",a,g,h)},function(a){d("throw",a,g,h)}):b.resolve(k).then(function(a){j.value=a,g(j)},function(a){return d("throw",a,g,h)})}h(i.arg)}var e;s(this,"_invoke",{value:function value(a,c){function f(){return new b(function(b,e){d(a,c,b,e)})}return e=e?e.then(f,f):f()}})}function i(a,b,d){var e="suspendedStart";return function(f,g){if("executing"==e)throw new Error("Generator is already running");if("completed"==e){if("throw"===f)throw g;return o()}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var i=j(h,d);if(i){if(i===x)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=c(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===x)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}function j(a,b){var d=b.method,e=a.iterator[d];if(void 0===e)return b.delegate=null,"throw"===d&&a.iterator["return"]&&(b.method="return",b.arg=void 0,j(a,b),"throw"===b.method)||"return"!==d&&(b.method="throw",b.arg=new TypeError("The iterator does not provide a '"+d+"' method")),x;var f=c(e,a.iterator,b.arg);if("throw"===f.type)return b.method="throw",b.arg=f.arg,b.delegate=null,x;var g=f.arg;return g?g.done?(b[a.resultName]=g.value,b.next=a.nextLoc,"return"!==b.method&&(b.method="next",b.arg=void 0),b.delegate=null,x):g:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,x)}function k(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 l(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function m(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(k,this),this.reset(!0)}function n(a){if(a){var b=a[u];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(r.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=void 0,b.done=!0,b};return d.next=d}}return{next:o}}function o(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return p};var p={},q=Object.prototype,r=q.hasOwnProperty,s=Object.defineProperty||function(a,b,c){a[b]=c.value},t="function"==typeof Symbol?Symbol:{},u=t.iterator||"@@iterator",v=t.asyncIterator||"@@asyncIterator",w=t.toStringTag||"@@toStringTag";try{a({},"")}catch(b){a=function(a,b,c){return a[b]=c}}p.wrap=b;var x={},y={};a(y,u,function(){return this});var z=Object.getPrototypeOf,A=z&&z(z(n([])));A&&A!==q&&r.call(A,u)&&(y=A);var B=f.prototype=d.prototype=Object.create(y);return e.prototype=f,s(B,"constructor",{value:f,configurable:!0}),s(f,"constructor",{value:e,configurable:!0}),e.displayName=a(f,w,"GeneratorFunction"),p.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===e||"GeneratorFunction"===(b.displayName||b.name))},p.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,f):(b.__proto__=f,a(b,w,"GeneratorFunction")),b.prototype=Object.create(B),b},p.awrap=function(a){return{__await:a}},g(h.prototype),a(h.prototype,v,function(){return this}),p.AsyncIterator=h,p.async=function(a,c,d,e,f){void 0===f&&(f=Promise);var g=new h(b(a,c,d,e),f);return p.isGeneratorFunction(c)?g:g.next().then(function(a){return a.done?a.value:g.next()})},g(B),a(B,w,"Generator"),a(B,u,function(){return this}),a(B,"toString",function(){return"[object Generator]"}),p.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}},p.values=n,m.prototype={constructor:m,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(l),!a)for(var b in this)"t"===b.charAt(0)&&r.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=void 0)},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(a){function b(b,d){return f.type="throw",f.arg=a,c.next=b,d&&(c.method="next",c.arg=void 0),!!d}if(this.done)throw a;for(var c=this,d=this.tryEntries.length-1;0<=d;--d){var e=this.tryEntries[d],f=e.completion;if("root"===e.tryLoc)return b("end");if(e.tryLoc<=this.prev){var g=r.call(e,"catchLoc"),h=r.call(e,"finallyLoc");if(g&&h){if(this.prev<e.catchLoc)return b(e.catchLoc,!0);if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(!g){if(!h)throw new Error("try statement without catch or finally");if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(this.prev<e.catchLoc)return b(e.catchLoc,!0)}}},abrupt:function abrupt(a,b){for(var c,d=this.tryEntries.length-1;0<=d;--d)if(c=this.tryEntries[d],c.tryLoc<=this.prev&&r.call(c,"finallyLoc")&&this.prev<c.finallyLoc){var e=c;break}e&&("break"===a||"continue"===a)&&e.tryLoc<=b&&b<=e.finallyLoc&&(e=null);var f=e?e.completion:{};return f.type=a,f.arg=b,e?(this.method="next",this.next=e.finallyLoc,x):this.complete(f)},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),x},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),l(b),x},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 e=d.arg;l(b)}return e}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:n(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=void 0),x}},p}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 lname="list_once";function do_once(){return _do_once.apply(this,arguments)}function _do_once(){return _do_once=_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:if(a&&"function"==typeof a){d.next=2;break}return d.abrupt("return",null);case 2:if(b&&""!=b||(b="fn-"+a.name),e=_core["default"].Global_get(lname,b),"true"!=e){d.next=10;break}if(!c){d.next=9;break}return d.next=8,c();case 8:return d.abrupt("return",d.sent);case 9:return d.abrupt("return",void 0);case 10:return _core["default"].Global_set(lname,b,"true"),d.next=13,a();case 13:return d.abrupt("return",d.sent);case 14:case"end":return d.stop();}},d)})),_do_once.apply(this,arguments)}function reset_once(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"";return a&&""!=a?(_core["default"].Global_set(lname,a,null),!0):(_core["default"].Global_set(lname,!0,null),!0)}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var _exportNames={};var g_once=_interopRequireWildcard(require("./g_once"));Object.defineProperty(exports,"__esModule",{value:!0});exports["default"]=void 0;Object.keys(g_once).forEach(function(a){"default"===a||"__esModule"===a||Object.prototype.hasOwnProperty.call(_exportNames,a)||a in exports&&exports[a]===g_once[a]||Object.defineProperty(exports,a,{enumerable:!0,get:function get(){return g_once[a]}})});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(a,b){if(!b&&a&&a.__esModule)return a;if(null===a||"object"!==_typeof(a)&&"function"!=typeof a)return{default:a};var c=_getRequireWildcardCache(b);if(c&&c.has(a))return c.get(a);var d={},e=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in a)if("default"!=f&&Object.prototype.hasOwnProperty.call(a,f)){var g=e?Object.getOwnPropertyDescriptor(a,f):null;g&&(g.get||g.set)?Object.defineProperty(d,f,g):d[f]=a[f]}return d["default"]=a,c&&c.set(a,d),d}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 ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){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 _default=_objectSpread({},g_once);exports["default"]=_default;
|
|
@@ -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 a(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function b(a,b,c,e){var f=b&&b.prototype instanceof d?b:d,g=Object.create(f.prototype),h=new m(e||[]);return s(g,"_invoke",{value:i(a,c,h)}),g}function c(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function d(){}function e(){}function f(){}function g(b){["next","throw","return"].forEach(function(c){a(b,c,function(a){return this._invoke(c,a)})})}function h(a,b){function d(e,f,g,h){var i=c(a[e],a,f);if("throw"!==i.type){var j=i.arg,k=j.value;return k&&"object"==_typeof(k)&&r.call(k,"__await")?b.resolve(k.__await).then(function(a){d("next",a,g,h)},function(a){d("throw",a,g,h)}):b.resolve(k).then(function(a){j.value=a,g(j)},function(a){return d("throw",a,g,h)})}h(i.arg)}var e;s(this,"_invoke",{value:function value(a,c){function f(){return new b(function(b,e){d(a,c,b,e)})}return e=e?e.then(f,f):f()}})}function i(a,b,d){var e="suspendedStart";return function(f,g){if("executing"==e)throw new Error("Generator is already running");if("completed"==e){if("throw"===f)throw g;return o()}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var i=j(h,d);if(i){if(i===x)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=c(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===x)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}function j(a,b){var d=b.method,e=a.iterator[d];if(void 0===e)return b.delegate=null,"throw"===d&&a.iterator["return"]&&(b.method="return",b.arg=void 0,j(a,b),"throw"===b.method)||"return"!==d&&(b.method="throw",b.arg=new TypeError("The iterator does not provide a '"+d+"' method")),x;var f=c(e,a.iterator,b.arg);if("throw"===f.type)return b.method="throw",b.arg=f.arg,b.delegate=null,x;var g=f.arg;return g?g.done?(b[a.resultName]=g.value,b.next=a.nextLoc,"return"!==b.method&&(b.method="next",b.arg=void 0),b.delegate=null,x):g:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,x)}function k(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 l(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function m(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(k,this),this.reset(!0)}function n(a){if(a){var b=a[u];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(r.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=void 0,b.done=!0,b};return d.next=d}}return{next:o}}function o(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return p};var p={},q=Object.prototype,r=q.hasOwnProperty,s=Object.defineProperty||function(a,b,c){a[b]=c.value},t="function"==typeof Symbol?Symbol:{},u=t.iterator||"@@iterator",v=t.asyncIterator||"@@asyncIterator",w=t.toStringTag||"@@toStringTag";try{a({},"")}catch(b){a=function(a,b,c){return a[b]=c}}p.wrap=b;var x={},y={};a(y,u,function(){return this});var z=Object.getPrototypeOf,A=z&&z(z(n([])));A&&A!==q&&r.call(A,u)&&(y=A);var B=f.prototype=d.prototype=Object.create(y);return e.prototype=f,s(B,"constructor",{value:f,configurable:!0}),s(f,"constructor",{value:e,configurable:!0}),e.displayName=a(f,w,"GeneratorFunction"),p.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===e||"GeneratorFunction"===(b.displayName||b.name))},p.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,f):(b.__proto__=f,a(b,w,"GeneratorFunction")),b.prototype=Object.create(B),b},p.awrap=function(a){return{__await:a}},g(h.prototype),a(h.prototype,v,function(){return this}),p.AsyncIterator=h,p.async=function(a,c,d,e,f){void 0===f&&(f=Promise);var g=new h(b(a,c,d,e),f);return p.isGeneratorFunction(c)?g:g.next().then(function(a){return a.done?a.value:g.next()})},g(B),a(B,w,"Generator"),a(B,u,function(){return this}),a(B,"toString",function(){return"[object Generator]"}),p.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}},p.values=n,m.prototype={constructor:m,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(l),!a)for(var b in this)"t"===b.charAt(0)&&r.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=void 0)},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(a){function b(b,d){return f.type="throw",f.arg=a,c.next=b,d&&(c.method="next",c.arg=void 0),!!d}if(this.done)throw a;for(var c=this,d=this.tryEntries.length-1;0<=d;--d){var e=this.tryEntries[d],f=e.completion;if("root"===e.tryLoc)return b("end");if(e.tryLoc<=this.prev){var g=r.call(e,"catchLoc"),h=r.call(e,"finallyLoc");if(g&&h){if(this.prev<e.catchLoc)return b(e.catchLoc,!0);if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(!g){if(!h)throw new Error("try statement without catch or finally");if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(this.prev<e.catchLoc)return b(e.catchLoc,!0)}}},abrupt:function abrupt(a,b){for(var c,d=this.tryEntries.length-1;0<=d;--d)if(c=this.tryEntries[d],c.tryLoc<=this.prev&&r.call(c,"finallyLoc")&&this.prev<c.finallyLoc){var e=c;break}e&&("break"===a||"continue"===a)&&e.tryLoc<=b&&b<=e.finallyLoc&&(e=null);var f=e?e.completion:{};return f.type=a,f.arg=b,e?(this.method="next",this.next=e.finallyLoc,x):this.complete(f)},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),x},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),l(b),x},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 e=d.arg;l(b)}return e}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:n(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=void 0),x}},p}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;try{crypto=require("@azrico/crypto")}catch(a){}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}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./g_storage";
|
|
@@ -1 +0,0 @@
|
|
|
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,4 +0,0 @@
|
|
|
1
|
-
export declare function set_translation(category: string, key: any, value?: any): boolean;
|
|
2
|
-
export declare function set_translation_provider(category: string, translator: (key: string) => string): (key: string) => string;
|
|
3
|
-
export declare function get_translation(category: string, key: any): string;
|
|
4
|
-
export declare function clear_translation(category: string, key?: any): undefined;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.clear_translation=clear_translation,exports.get_translation=get_translation,exports.set_translation=set_translation,exports.set_translation_provider=set_translation_provider;var _index=require("../core/index"),lname="trnsl-",lprovidername="trnsl-prov-";/* -------------------------------------------------------------------------- */function set_translation(a,b,c){return a=lname+a,_index.GlobalStorage.Global_set(a,b,c)}function set_translation_provider(a,b){return _index.GlobalStorage.Global_set(lprovidername,a,b)}function get_translation(a,b){a=lname+a;/* ------------------------- get direct translation ------------------------- */var c=_index.GlobalStorage.Global_get(a,b);/* ------------------------- try to use the provider ------------------------ */if("function"==typeof c&&(c=c()),null==c){var d=_index.GlobalStorage.Global_get(lprovidername,a);"function"==typeof d&&(c=d(b))}/* --------------------------------- default -------------------------------- */return b}function clear_translation(a,b){return a=lname+a,_index.GlobalStorage.Global_set(a,b||!0,void 0)}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./gtranslate";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var _gtranslate=require("./gtranslate");Object.defineProperty(exports,"__esModule",{value:!0});Object.keys(_gtranslate).forEach(function(a){"default"===a||"__esModule"===a||a in exports&&exports[a]===_gtranslate[a]||Object.defineProperty(exports,a,{enumerable:!0,get:function get(){return _gtranslate[a]}})});
|