Socket
Socket
Sign inDemoInstall

commonly-decorators

Package Overview
Dependencies
8
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.8.0 to 0.8.1

14

dist/commonly-decorators.es.js

@@ -520,3 +520,3 @@ import freezeClick from 'freeze-click';

target.onUnload = function newOnUnload() {
var _a, _b, _c;
var _a, _b, _c, _d;
var opts = [];

@@ -528,4 +528,4 @@ for (var _i = 0; _i < arguments.length; _i++) {

var result;
return __generator(this, function (_d) {
switch (_d.label) {
return __generator(this, function (_e) {
switch (_e.label) {
case 0:

@@ -535,6 +535,8 @@ (_b = (_a = this === null || this === void 0 ? void 0 : this.__polling__list__) === null || _a === void 0 ? void 0 : _a[pollingId]) === null || _b === void 0 ? void 0 : _b.forEach(function (item) {

});
this.__polling__list__[pollingId] = null;
return [4 /*yield*/, ((_c = originOnUnload === null || originOnUnload === void 0 ? void 0 : originOnUnload.apply) === null || _c === void 0 ? void 0 : _c.call(originOnUnload, this, opts))];
if ((_c = this === null || this === void 0 ? void 0 : this.__polling__list__) === null || _c === void 0 ? void 0 : _c[pollingId]) {
this.__polling__list__[pollingId] = null;
}
return [4 /*yield*/, ((_d = originOnUnload === null || originOnUnload === void 0 ? void 0 : originOnUnload.apply) === null || _d === void 0 ? void 0 : _d.call(originOnUnload, this, opts))];
case 1:
result = _d.sent();
result = _e.sent();
return [2 /*return*/, result];

@@ -541,0 +543,0 @@ }

@@ -1,1 +0,1 @@

!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("freeze-click")):"function"==typeof define&&define.amd?define(["exports","freeze-click"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).commonlyDecorators={},t.freezeClick)}(this,(function(t,n){"use strict";function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var r=e(n),i=function(t,n){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},i(t,n)};function o(t,n,e,r){return new(e||(e=Promise))((function(i,o){function u(t){try{s(r.next(t))}catch(t){o(t)}}function l(t){try{s(r.throw(t))}catch(t){o(t)}}function s(t){var n;t.done?i(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(u,l)}s((r=r.apply(t,n||[])).next())}))}function u(t,n){var e,r,i,o,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(o){return function(l){return function(o){if(e)throw new TypeError("Generator is already executing.");for(;u;)try{if(e=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return u.label++,{value:o[1],done:!1};case 5:u.label++,r=o[1],o=[0];continue;case 7:o=u.ops.pop(),u.trys.pop();continue;default:if(!(i=u.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){u=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){u.label=o[1];break}if(6===o[0]&&u.label<i[1]){u.label=i[1],i=o;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(o);break}i[2]&&u.ops.pop(),u.trys.pop();continue}o=n.call(t,u)}catch(t){o=[6,t],r=0}finally{e=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,l])}}}function l(t,n,e){if(e||2===arguments.length)for(var r,i=0,o=n.length;i<o;i++)!r&&i in n||(r||(r=Array.prototype.slice.call(n,0,i)),r[i]=n[i]);return t.concat(r||Array.prototype.slice.call(n))}function s(t){return void 0===t&&(t=1e4),function(n,e,i){var l=i.value;i.value=r.default((function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,3,4]),[4,l.apply(this,n)];case 1:return[2,e.sent()];case 2:throw e.sent();case 3:return t.cancel(),[7];case 4:return[2]}}))}))}),t)}}function a(t,n,e){return function(r,i){var s=r[t];"function"==typeof s||"function"==typeof(null==s?void 0:s.then)?r[t]=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return o(this,void 0,void 0,(function(){var r;return u(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),r=(t[0]?null==e?void 0:e.map((function(n){return t[0][n]})):[])||[],this[i]=new(n.bind.apply(n,l([void 0],r,!1))),[4,s.apply(this,t)];case 1:return[2,o.sent()];case 2:throw o.sent();case 3:return[2]}}))}))}:r[t]=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return o(this,void 0,void 0,(function(){var r;return u(this,(function(o){try{r=(t[0]?null==e?void 0:e.map((function(n){return t[0][n]})):[])||[],this[i]=new(n.bind.apply(n,l([void 0],r,!1)))}catch(t){console.error(t)}return[2]}))}))}}}function c(t,n){return function(e,r){var i=e[t];"function"==typeof i||"function"==typeof(null==i?void 0:i.then)?e[t]=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),this[r]=n,[4,i.apply(this,t)];case 1:return[2,e.sent()];case 2:throw e.sent();case 3:return[2]}}))}))}:e[t]=function(){return o(this,void 0,void 0,(function(){return u(this,(function(t){try{this[r]=n}catch(t){console.error(t)}return[2]}))}))}}}var _=function(){function t(t,n,e){void 0===n&&(n=null),void 0===e&&(e="success"),this.msg="",this.extraData=null,this.status=t,this.data=n,this.msg=e}return t.prototype.getStatus=function(){return this.status},t.prototype.getData=function(){return this.data},t.prototype.getMsg=function(){return this.msg},t.prototype.setMsg=function(t){this.msg=t},t.prototype.getExtraData=function(){return this.extraData},t.prototype.setExtraData=function(t){this.extraData=t},t.isOk=function(t){return f(t)&&"ok"===t.getStatus()},t.isFail=function(t){return f(t)&&"fail"===t.getStatus()},t.isDeny=function(t){return f(t)&&"deny"===t.getStatus()},t.hasData=function(t){if(!t||"function"!=typeof t.getData)return!1;var n=t.getData();return!(null==n)},t.isNetWorkError=function(n){return t.getStatusIsFunction(n)&&"NETWORK_ERROR"===n.getStatus()||"NETWORK_ERROR"===(null==n?void 0:n.status)},t.cover=function(n,e){t[n]=e},t.success=function(n){return new t("ok",n)},t.fail=function(n){var e=new t("fail",null);return e.setMsg(n||""),e},t.exception=function(n){return new t(n.getStatus(),n.getData(),n.getMsg())},t.deny=function(n){return new t("deny",null,n||"")},t.networkError=function(n){return new t("NETWORK_ERROR",null,n||"网络异常,请重试")},t.interrupt=function(n){return new t("INTERRUPT",null,n||"程序中断,请重试")},t.isInterrupt=function(n){return"INTERRUPT"===t.getStatusValue(n)},t.cancel=function(n){return new t("CANCEL",null,n||"网络异常,请重试")},t.isCancel=function(n){return"CANCEL"===t.getStatusValue(n)},t.error=function(t){return new this("ERROR",null,t||"程序中断,请重试")},t.isError=function(n){return"ERROR"===t.getStatusValue(n)},t.getStatusIsFunction=function(t){return t&&"function"==typeof t.getStatus},t.getStatusValue=function(n){var e;return t.getStatusIsFunction(n)?n.getStatus():null!==(e=null==n?void 0:n.status)&&void 0!==e?e:""},t}();function f(t){return t&&"function"==typeof t.getStatus}function p(t,n){return void 0===t&&(t=1e3),void 0===n&&(n="__polling__"),function(e,r,i){var l=i.value;i.value=function e(){for(var r=this,i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];return this.__polling__list__||(this.__polling__list__=Object.create(null)),this.__polling__list__[n]||(this.__polling__list__[n]=[]),Array.isArray(this.__polling__list__[n])||(this.__polling__list__[n]=[this.__polling__list__[n]]),new Promise((function(s){return o(r,void 0,void 0,(function(){var r,a,c=this;return u(this,(function(f){switch(f.label){case 0:return[4,l.apply(this,i)];case 1:return r=f.sent(),_.isOk(r)?(s(r),[2]):(a=setTimeout((function(){return o(c,void 0,void 0,(function(){var t,r;return u(this,(function(o){return this.__polling__list__[n]=null===(r=null===(t=this.__polling__list__)||void 0===t?void 0:t[n])||void 0===r?void 0:r.filter((function(t){return t!==a})),clearTimeout(a),e.apply(this,i),[2]}))}))}),t),this.__polling__list__[n].push(a),[2])}}))}))}))};var s=e.onUnload;e.onUnload=function(){for(var t,e,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];return o(this,void 0,void 0,(function(){return u(this,(function(i){switch(i.label){case 0:return null===(e=null===(t=null==this?void 0:this.__polling__list__)||void 0===t?void 0:t[n])||void 0===e||e.forEach((function(t){clearTimeout(t)})),this.__polling__list__[n]=null,[4,s.apply(this,r)];case 1:return[2,i.sent()]}}))}))}}}function h(t,n){return void 0===t&&(t=1e3),void 0===n&&(n="__polling__"),function(e,r,i){var l=i.value;i.value=function e(){for(var r=this,i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];return this.__polling__list__||(this.__polling__list__=Object.create(null)),this.__polling__list__[n]||(this.__polling__list__[n]=[]),Array.isArray(this.__polling__list__[n])||(this.__polling__list__[n]=[this.__polling__list__[n]]),new Promise((function(s){return o(r,void 0,void 0,(function(){var r,a=this;return u(this,(function(c){return r=setTimeout((function(){return o(a,void 0,void 0,(function(){var t,o,a;return u(this,(function(u){switch(u.label){case 0:return this.__polling__list__[n]=null===(a=null===(o=this.__polling__list__)||void 0===o?void 0:o[n])||void 0===a?void 0:a.filter((function(t){return t!==r})),clearTimeout(r),[4,l.apply(this,i)];case 1:return t=u.sent(),_.isOk(t)?(s(t),[2]):(e.apply(this,i),[2])}}))}))}),t),this.__polling__list__[n].push(r),[2]}))}))}))};var s=null==e?void 0:e.onUnload;e.onUnload=function(){for(var t,e,r,i=[],l=0;l<arguments.length;l++)i[l]=arguments[l];return o(this,void 0,void 0,(function(){return u(this,(function(o){switch(o.label){case 0:return null===(e=null===(t=null==this?void 0:this.__polling__list__)||void 0===t?void 0:t[n])||void 0===e||e.forEach((function(t){clearTimeout(t)})),this.__polling__list__[n]=null,[4,null===(r=null==s?void 0:s.apply)||void 0===r?void 0:r.call(s,this,i)];case 1:return[2,o.sent()]}}))}))}}}function v(t,n){var e,r;void 0===n&&(n="__polling__");try{null===(r=null===(e=t.__polling__list__)||void 0===e?void 0:e[n])||void 0===r||r.forEach((function(t){clearTimeout(t)})),t.__polling__list__[n]=null}catch(t){console.error(t)}}function d(t){try{Object.keys((null==t?void 0:t.__polling__list__)||{}).forEach((function(n){var e,r,i;null===(r=null===(e=null==t?void 0:t.__polling__list__)||void 0===e?void 0:e[n])||void 0===r||r.forEach((function(t){clearTimeout(t)})),clearTimeout(null===(i=null==t?void 0:t.__polling__list__)||void 0===i?void 0:i[n]),t.__polling__list__[n]=null}))}catch(t){console.error(t)}}function g(){return function(t,n,e){var r=e.value;e.value=function(){for(var t=this,n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var i=r.apply(this,n);return"object"==typeof i&&"function"==typeof(null==i?void 0:i.then)?i.then((function(){d(t)}),(function(){d(t)})):(d(this),i)}}}var y=Object.freeze({__proto__:null,Polling:p,Assemble:a,AssembleValue:c,PollingAfter:h,pollingClear:v,pollingClearAll:d,PollingClearAllDeco:g});var b=function(t){function n(n){var e=t.call(this,n)||this;return e.__id="ParameterDecoratorError",e.status="PARAM_ERROR",e.data=null,e.from="CheckParamRequired",e}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}i(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}(n,t),n.prototype.setData=function(t){this.data=t},n.prototype.getData=function(){return this.data},n.prototype.setStatus=function(t){this.status=t},n.prototype.getStatus=function(){return this.status},n.prototype.setFrom=function(t){this.from=t},n.prototype.getFrom=function(){return this.from},n.isParameterDecoratorError=function(t){return t instanceof n||(null==t?void 0:t.__id)===new n("").__id},n}(Error);var m={Required:function(t,n){return void 0===n&&(n=""),function(e,r,i){(null==e?void 0:e.__requiredData)||(e.__requiredData=new Map),e.__requiredData.set(r,{index:i,errMsg:t,propertyPath:n})}},CheckParamRequired:function(t,n,e){var r=e.value;e.value=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return o(this,void 0,void 0,(function(){var i,o,l,s,a,c;return u(this,(function(u){switch(u.label){case 0:if(i=null==t?void 0:t.__requiredData,o=i.get(n),l=Number(null==o?void 0:o.index),s=null==o?void 0:o.propertyPath,a=(null==s?void 0:s.split("."))||[],c=a.reduce((function(t,n){return null==t||!n&&0!==n||"."===n?t:null==t?void 0:t[n]}),null==e?void 0:e[l]),!isNaN(l)&&(void 0===c||""===c||null===c))throw new b((null==o?void 0:o.errMsg)||"第".concat(l+1,"个参数必传"));return[4,r.apply(this,e)];case 1:return[2,u.sent()]}}))}))}},ParameterDecoratorError:b},w={freeze:s,miniprogram:y};t.Assemble=a,t.AssembleValue=c,t.ParamDecorator=m,t.Polling=p,t.PollingAfter=h,t.PollingClearAllDeco=g,t.default=w,t.freeze=s,t.pollingClear=v,t.pollingClearAll=d,Object.defineProperty(t,"__esModule",{value:!0})}));//# sourceMappingURL=commonly-decorators.min.js.map
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("freeze-click")):"function"==typeof define&&define.amd?define(["exports","freeze-click"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).commonlyDecorators={},t.freezeClick)}(this,(function(t,n){"use strict";function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=e(n),r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},r(t,n)};function o(t,n,e,i){return new(e||(e=Promise))((function(r,o){function l(t){try{s(i.next(t))}catch(t){o(t)}}function u(t){try{s(i.throw(t))}catch(t){o(t)}}function s(t){var n;t.done?r(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(l,u)}s((i=i.apply(t,n||[])).next())}))}function l(t,n){var e,i,r,o,l={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(e)throw new TypeError("Generator is already executing.");for(;l;)try{if(e=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return l.label++,{value:o[1],done:!1};case 5:l.label++,i=o[1],o=[0];continue;case 7:o=l.ops.pop(),l.trys.pop();continue;default:if(!(r=l.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){l=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){l.label=o[1];break}if(6===o[0]&&l.label<r[1]){l.label=r[1],r=o;break}if(r&&l.label<r[2]){l.label=r[2],l.ops.push(o);break}r[2]&&l.ops.pop(),l.trys.pop();continue}o=n.call(t,l)}catch(t){o=[6,t],i=0}finally{e=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}function u(t,n,e){if(e||2===arguments.length)for(var i,r=0,o=n.length;r<o;r++)!i&&r in n||(i||(i=Array.prototype.slice.call(n,0,r)),i[r]=n[r]);return t.concat(i||Array.prototype.slice.call(n))}function s(t){return void 0===t&&(t=1e4),function(n,e,r){var u=r.value;r.value=i.default((function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return o(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,3,4]),[4,u.apply(this,n)];case 1:return[2,e.sent()];case 2:throw e.sent();case 3:return t.cancel(),[7];case 4:return[2]}}))}))}),t)}}function a(t,n,e){return function(i,r){var s=i[t];"function"==typeof s||"function"==typeof(null==s?void 0:s.then)?i[t]=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return o(this,void 0,void 0,(function(){var i;return l(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),i=(t[0]?null==e?void 0:e.map((function(n){return t[0][n]})):[])||[],this[r]=new(n.bind.apply(n,u([void 0],i,!1))),[4,s.apply(this,t)];case 1:return[2,o.sent()];case 2:throw o.sent();case 3:return[2]}}))}))}:i[t]=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return o(this,void 0,void 0,(function(){var i;return l(this,(function(o){try{i=(t[0]?null==e?void 0:e.map((function(n){return t[0][n]})):[])||[],this[r]=new(n.bind.apply(n,u([void 0],i,!1)))}catch(t){console.error(t)}return[2]}))}))}}}function c(t,n){return function(e,i){var r=e[t];"function"==typeof r||"function"==typeof(null==r?void 0:r.then)?e[t]=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return o(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),this[i]=n,[4,r.apply(this,t)];case 1:return[2,e.sent()];case 2:throw e.sent();case 3:return[2]}}))}))}:e[t]=function(){return o(this,void 0,void 0,(function(){return l(this,(function(t){try{this[i]=n}catch(t){console.error(t)}return[2]}))}))}}}var _=function(){function t(t,n,e){void 0===n&&(n=null),void 0===e&&(e="success"),this.msg="",this.extraData=null,this.status=t,this.data=n,this.msg=e}return t.prototype.getStatus=function(){return this.status},t.prototype.getData=function(){return this.data},t.prototype.getMsg=function(){return this.msg},t.prototype.setMsg=function(t){this.msg=t},t.prototype.getExtraData=function(){return this.extraData},t.prototype.setExtraData=function(t){this.extraData=t},t.isOk=function(t){return f(t)&&"ok"===t.getStatus()},t.isFail=function(t){return f(t)&&"fail"===t.getStatus()},t.isDeny=function(t){return f(t)&&"deny"===t.getStatus()},t.hasData=function(t){if(!t||"function"!=typeof t.getData)return!1;var n=t.getData();return!(null==n)},t.isNetWorkError=function(n){return t.getStatusIsFunction(n)&&"NETWORK_ERROR"===n.getStatus()||"NETWORK_ERROR"===(null==n?void 0:n.status)},t.cover=function(n,e){t[n]=e},t.success=function(n){return new t("ok",n)},t.fail=function(n){var e=new t("fail",null);return e.setMsg(n||""),e},t.exception=function(n){return new t(n.getStatus(),n.getData(),n.getMsg())},t.deny=function(n){return new t("deny",null,n||"")},t.networkError=function(n){return new t("NETWORK_ERROR",null,n||"网络异常,请重试")},t.interrupt=function(n){return new t("INTERRUPT",null,n||"程序中断,请重试")},t.isInterrupt=function(n){return"INTERRUPT"===t.getStatusValue(n)},t.cancel=function(n){return new t("CANCEL",null,n||"网络异常,请重试")},t.isCancel=function(n){return"CANCEL"===t.getStatusValue(n)},t.error=function(t){return new this("ERROR",null,t||"程序中断,请重试")},t.isError=function(n){return"ERROR"===t.getStatusValue(n)},t.getStatusIsFunction=function(t){return t&&"function"==typeof t.getStatus},t.getStatusValue=function(n){var e;return t.getStatusIsFunction(n)?n.getStatus():null!==(e=null==n?void 0:n.status)&&void 0!==e?e:""},t}();function f(t){return t&&"function"==typeof t.getStatus}function p(t,n){return void 0===t&&(t=1e3),void 0===n&&(n="__polling__"),function(e,i,r){var u=r.value;r.value=function e(){for(var i=this,r=[],s=0;s<arguments.length;s++)r[s]=arguments[s];return this.__polling__list__||(this.__polling__list__=Object.create(null)),this.__polling__list__[n]||(this.__polling__list__[n]=[]),Array.isArray(this.__polling__list__[n])||(this.__polling__list__[n]=[this.__polling__list__[n]]),new Promise((function(s){return o(i,void 0,void 0,(function(){var i,a,c=this;return l(this,(function(f){switch(f.label){case 0:return[4,u.apply(this,r)];case 1:return i=f.sent(),_.isOk(i)?(s(i),[2]):(a=setTimeout((function(){return o(c,void 0,void 0,(function(){var t,i;return l(this,(function(o){return this.__polling__list__[n]=null===(i=null===(t=this.__polling__list__)||void 0===t?void 0:t[n])||void 0===i?void 0:i.filter((function(t){return t!==a})),clearTimeout(a),e.apply(this,r),[2]}))}))}),t),this.__polling__list__[n].push(a),[2])}}))}))}))};var s=e.onUnload;e.onUnload=function(){for(var t,e,i=[],r=0;r<arguments.length;r++)i[r]=arguments[r];return o(this,void 0,void 0,(function(){return l(this,(function(r){switch(r.label){case 0:return null===(e=null===(t=null==this?void 0:this.__polling__list__)||void 0===t?void 0:t[n])||void 0===e||e.forEach((function(t){clearTimeout(t)})),this.__polling__list__[n]=null,[4,s.apply(this,i)];case 1:return[2,r.sent()]}}))}))}}}function h(t,n){return void 0===t&&(t=1e3),void 0===n&&(n="__polling__"),function(e,i,r){var u=r.value;r.value=function e(){for(var i=this,r=[],s=0;s<arguments.length;s++)r[s]=arguments[s];return this.__polling__list__||(this.__polling__list__=Object.create(null)),this.__polling__list__[n]||(this.__polling__list__[n]=[]),Array.isArray(this.__polling__list__[n])||(this.__polling__list__[n]=[this.__polling__list__[n]]),new Promise((function(s){return o(i,void 0,void 0,(function(){var i,a=this;return l(this,(function(c){return i=setTimeout((function(){return o(a,void 0,void 0,(function(){var t,o,a;return l(this,(function(l){switch(l.label){case 0:return this.__polling__list__[n]=null===(a=null===(o=this.__polling__list__)||void 0===o?void 0:o[n])||void 0===a?void 0:a.filter((function(t){return t!==i})),clearTimeout(i),[4,u.apply(this,r)];case 1:return t=l.sent(),_.isOk(t)?(s(t),[2]):(e.apply(this,r),[2])}}))}))}),t),this.__polling__list__[n].push(i),[2]}))}))}))};var s=null==e?void 0:e.onUnload;e.onUnload=function(){for(var t,e,i,r,u=[],a=0;a<arguments.length;a++)u[a]=arguments[a];return o(this,void 0,void 0,(function(){return l(this,(function(o){switch(o.label){case 0:return null===(e=null===(t=null==this?void 0:this.__polling__list__)||void 0===t?void 0:t[n])||void 0===e||e.forEach((function(t){clearTimeout(t)})),(null===(i=null==this?void 0:this.__polling__list__)||void 0===i?void 0:i[n])&&(this.__polling__list__[n]=null),[4,null===(r=null==s?void 0:s.apply)||void 0===r?void 0:r.call(s,this,u)];case 1:return[2,o.sent()]}}))}))}}}function v(t,n){var e,i;void 0===n&&(n="__polling__");try{null===(i=null===(e=t.__polling__list__)||void 0===e?void 0:e[n])||void 0===i||i.forEach((function(t){clearTimeout(t)})),t.__polling__list__[n]=null}catch(t){console.error(t)}}function d(t){try{Object.keys((null==t?void 0:t.__polling__list__)||{}).forEach((function(n){var e,i,r;null===(i=null===(e=null==t?void 0:t.__polling__list__)||void 0===e?void 0:e[n])||void 0===i||i.forEach((function(t){clearTimeout(t)})),clearTimeout(null===(r=null==t?void 0:t.__polling__list__)||void 0===r?void 0:r[n]),t.__polling__list__[n]=null}))}catch(t){console.error(t)}}function g(){return function(t,n,e){var i=e.value;e.value=function(){for(var t=this,n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var r=i.apply(this,n);return"object"==typeof r&&"function"==typeof(null==r?void 0:r.then)?r.then((function(){d(t)}),(function(){d(t)})):(d(this),r)}}}var y=Object.freeze({__proto__:null,Polling:p,Assemble:a,AssembleValue:c,PollingAfter:h,pollingClear:v,pollingClearAll:d,PollingClearAllDeco:g});var b=function(t){function n(n){var e=t.call(this,n)||this;return e.__id="ParameterDecoratorError",e.status="PARAM_ERROR",e.data=null,e.from="CheckParamRequired",e}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}r(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}(n,t),n.prototype.setData=function(t){this.data=t},n.prototype.getData=function(){return this.data},n.prototype.setStatus=function(t){this.status=t},n.prototype.getStatus=function(){return this.status},n.prototype.setFrom=function(t){this.from=t},n.prototype.getFrom=function(){return this.from},n.isParameterDecoratorError=function(t){return t instanceof n||(null==t?void 0:t.__id)===new n("").__id},n}(Error);var m={Required:function(t,n){return void 0===n&&(n=""),function(e,i,r){(null==e?void 0:e.__requiredData)||(e.__requiredData=new Map),e.__requiredData.set(i,{index:r,errMsg:t,propertyPath:n})}},CheckParamRequired:function(t,n,e){var i=e.value;e.value=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return o(this,void 0,void 0,(function(){var r,o,u,s,a,c;return l(this,(function(l){switch(l.label){case 0:if(r=null==t?void 0:t.__requiredData,o=r.get(n),u=Number(null==o?void 0:o.index),s=null==o?void 0:o.propertyPath,a=(null==s?void 0:s.split("."))||[],c=a.reduce((function(t,n){return null==t||!n&&0!==n||"."===n?t:null==t?void 0:t[n]}),null==e?void 0:e[u]),!isNaN(u)&&(void 0===c||""===c||null===c))throw new b((null==o?void 0:o.errMsg)||"第".concat(u+1,"个参数必传"));return[4,i.apply(this,e)];case 1:return[2,l.sent()]}}))}))}},ParameterDecoratorError:b},w={freeze:s,miniprogram:y};t.Assemble=a,t.AssembleValue=c,t.ParamDecorator=m,t.Polling=p,t.PollingAfter=h,t.PollingClearAllDeco=g,t.default=w,t.freeze=s,t.pollingClear=v,t.pollingClearAll=d,Object.defineProperty(t,"__esModule",{value:!0})}));//# sourceMappingURL=commonly-decorators.min.js.map

@@ -166,3 +166,3 @@ "use strict";

target.onUnload = function newOnUnload() {
var _a, _b, _c;
var _a, _b, _c, _d;
var opts = [];

@@ -174,4 +174,4 @@ for (var _i = 0; _i < arguments.length; _i++) {

var result;
return __generator(this, function (_d) {
switch (_d.label) {
return __generator(this, function (_e) {
switch (_e.label) {
case 0:

@@ -181,6 +181,8 @@ (_b = (_a = this === null || this === void 0 ? void 0 : this.__polling__list__) === null || _a === void 0 ? void 0 : _a[pollingId]) === null || _b === void 0 ? void 0 : _b.forEach(function (item) {

});
this.__polling__list__[pollingId] = null;
return [4 /*yield*/, ((_c = originOnUnload === null || originOnUnload === void 0 ? void 0 : originOnUnload.apply) === null || _c === void 0 ? void 0 : _c.call(originOnUnload, this, opts))];
if ((_c = this === null || this === void 0 ? void 0 : this.__polling__list__) === null || _c === void 0 ? void 0 : _c[pollingId]) {
this.__polling__list__[pollingId] = null;
}
return [4 /*yield*/, ((_d = originOnUnload === null || originOnUnload === void 0 ? void 0 : originOnUnload.apply) === null || _d === void 0 ? void 0 : _d.call(originOnUnload, this, opts))];
case 1:
result = _d.sent();
result = _e.sent();
return [2 /*return*/, result];

@@ -187,0 +189,0 @@ }

{
"name": "commonly-decorators",
"version": "0.8.0",
"version": "0.8.1",
"description": "some commonly decorators",

@@ -5,0 +5,0 @@ "author": "yiri.zhou",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc