Socket
Socket
Sign inDemoInstall

commonly-decorators

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

commonly-decorators - npm Package Compare versions

Comparing version 0.8.1 to 0.8.2

10

dist/commonly-decorators.es.js

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

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

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

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

@@ -461,5 +461,5 @@ (_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*/, originOnUnload.apply(this, opts)];
return [4 /*yield*/, ((_c = originOnUnload === null || originOnUnload === void 0 ? void 0 : originOnUnload.apply) === null || _c === void 0 ? void 0 : _c.call(originOnUnload, this, opts))];
case 1:
result = _c.sent();
result = _d.sent();
return [2 /*return*/, result];

@@ -466,0 +466,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 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
!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=[],u=0;u<arguments.length;u++)r[u]=arguments[u];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)})),this.__polling__list__[n]=null,[4,null===(i=null==s?void 0:s.apply)||void 0===i?void 0:i.call(s,this,r)];case 1:return[2,o.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

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

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

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

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

@@ -106,5 +106,5 @@ (_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*/, originOnUnload.apply(this, opts)];
return [4 /*yield*/, ((_c = originOnUnload === null || originOnUnload === void 0 ? void 0 : originOnUnload.apply) === null || _c === void 0 ? void 0 : _c.call(originOnUnload, this, opts))];
case 1:
result = _c.sent();
result = _d.sent();
return [2 /*return*/, result];

@@ -111,0 +111,0 @@ }

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

@@ -10,2 +10,3 @@ "author": "yiri.zhou",

"scripts": {
"test": "echo success",
"lint": "eslint --ext .ts --ext .tsx src -c .eslintrc.js",

@@ -12,0 +13,0 @@ "fix": "npm run lint --fix",

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc