pubo-utils 1.0.34 → 1.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pubo-utils.js +1 -1
- package/es/emitter/index.d.ts +1 -1
- package/es/emitter/index.js +21 -215
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/lib/emitter/index.d.ts +1 -1
- package/lib/emitter/index.js +21 -215
- package/lib/index.d.ts +1 -0
- package/lib/index.js +9 -0
- package/package.json +2 -2
package/dist/pubo-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports["pubo-utils"]=n():t["pubo-utils"]=n()}(this,(function(){return function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(r,o,function(n){return t[n]}.bind(null,o));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=0)}([function(t,n,e){"use strict";e.r(n),e.d(n,"debounce",(function(){return u})),e.d(n,"hex2rgb",(function(){return c})),e.d(n,"Emitter",(function(){return y})),e.d(n,"superFactory",(function(){return v})),e.d(n,"loop",(function(){return k})),e.d(n,"waitFor",(function(){return S})),e.d(n,"SyncQueue",(function(){return P})),e.d(n,"random",(function(){return a})),e.d(n,"sleep",(function(){return w})),e.d(n,"throttle",(function(){return E})),e.d(n,"ContinuousTrigger",(function(){return A})),e.d(n,"Base64Utils",(function(){return r})),e.d(n,"HistoryStack",(function(){return I}));var r={};e.r(r),e.d(r,"EncoderMap",(function(){return M})),e.d(r,"toUnit8Array",(function(){return G}));var o=function(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,o,i=e.call(t),u=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)u.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return u},i=function(){for(var t=[],n=0;n<arguments.length;n++)t=t.concat(o(arguments[n]));return t},u=function(t,n,e){if(void 0===e&&(e=!1),e){var r,o=!0;return function(){for(var e=[],u=0;u<arguments.length;u++)e[u]=arguments[u];o&&(t.apply(void 0,i(e)),o=!1),r&&clearTimeout(r),r=setTimeout((function(){return o=!0}),n)}}var u;return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];u&&clearTimeout(u),u=setTimeout((function(){return t.apply(void 0,i(e))}),n)}},c=function(t){var n=t.toString(2).padStart(24,0);return[parseInt(n.slice(0,8),2),parseInt(n.slice(8,16),2),parseInt(n.slice(16,24),2)]},a=function(t){void 0===t&&(t=8);var n=function(t){return Math.random().toString(32).slice(2,2+t)};if(t<=8)return n(t);for(var e="",r=0;r<=t;r+=8)e+=n(t-r>8?8:t-r);return e},l=function(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function c(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){var n;t.done?o(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(u,c)}a((r=r.apply(t,n||[])).next())}))},f=function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(e)throw new TypeError("Generator is already executing.");for(;u;)try{if(e=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=n.call(t,u)}catch(t){i=[6,t],r=0}finally{e=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},s=function(t){var n="function"==typeof Symbol&&Symbol.iterator,e=n&&t[n],r=0;if(e)return e.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},h=function(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,o,i=e.call(t),u=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)u.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return u},p=function(){for(var t=[],n=0;n<arguments.length;n++)t=t.concat(h(arguments[n]));return t},y=function(){function t(){this.state={},this.ids={}}return t.prototype.on=function(t,n){if(this.state[t]||(this.state[t]=[]),"function"!=typeof n)throw new Error("第二个参数必须为function!");var e=this.state[t].push(n)-1,r=a(40);return this.ids[r]={event:t,index:e},r},t.prototype.cancel=function(t){if(t){var n=this.ids[t]||{},e=n.event,r=n.index;e&&Array.isArray(this.state[e])&&this.state[e].splice(r,1)}else this.clear()},t.prototype.clear=function(){this.state.length=0},t.prototype.emit=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return l(this,void 0,void 0,(function(){var e,r,o,i,u,c;return f(this,(function(a){switch(a.label){case 0:if(!Array.isArray(this.state[t]))return[3,8];a.label=1;case 1:a.trys.push([1,6,7,8]),e=s(this.state[t]),r=e.next(),a.label=2;case 2:return r.done?[3,5]:"function"!=typeof(o=r.value)?[3,4]:[4,o.apply(void 0,p(n))];case 3:a.sent(),a.label=4;case 4:return r=e.next(),[3,2];case 5:return[3,8];case 6:return i=a.sent(),u={error:i},[3,8];case 7:try{r&&!r.done&&(c=e.return)&&c.call(e)}finally{if(u)throw u.error}return[7];case 8:return[2]}}))}))},t}(),d=function(t){var n="function"==typeof Symbol&&Symbol.iterator,e=n&&t[n],r=0;if(e)return e.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},v=function(t){return function(n){var e,r,o={};try{for(var i=d(Object.keys(n)),u=i.next();!u.done;u=i.next()){var c=u.value;o[c]=t(n[c],c)}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return o}},b=function(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function c(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){var n;t.done?o(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(u,c)}a((r=r.apply(t,n||[])).next())}))},m=function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(e)throw new TypeError("Generator is already executing.");for(;u;)try{if(e=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=n.call(t,u)}catch(t){i=[6,t],r=0}finally{e=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},w=function(t){return b(void 0,void 0,void 0,(function(){return m(this,(function(n){switch(n.label){case 0:return[4,new Promise((function(n){return setTimeout((function(){return n()}),t)}))];case 1:return n.sent(),[2]}}))}))},g=function(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function c(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){var n;t.done?o(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(u,c)}a((r=r.apply(t,n||[])).next())}))},x=function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(e)throw new TypeError("Generator is already executing.");for(;u;)try{if(e=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=n.call(t,u)}catch(t){i=[6,t],r=0}finally{e=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},k=function(t,n){var e=!0,r=function(){e=!1},o=function(){return g(void 0,void 0,void 0,(function(){return x(this,(function(i){switch(i.label){case 0:return[4,t(r)];case 1:return i.sent(),[4,w(n)];case 2:return i.sent(),e?o():o=null,[2]}}))}))};return o(),r},S=function(t,n){var e=void 0===n?{}:n,r=e.checkTime,o=e.timeout;return new Promise((function(n,e){var i=k((function(){return g(void 0,void 0,void 0,(function(){var e;return x(this,(function(r){switch(r.label){case 0:return[4,t()];case 1:return(e=r.sent())&&(i(),n(e)),[2]}}))}))}),r||100);o&&setTimeout((function(){i(),e("timeout")}),o)}))},T=function(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function c(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){var n;t.done?o(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(u,c)}a((r=r.apply(t,n||[])).next())}))},j=function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(e)throw new TypeError("Generator is already executing.");for(;u;)try{if(e=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=n.call(t,u)}catch(t){i=[6,t],r=0}finally{e=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},P=function(){function t(){this.cache=[],this.running=!1}return t.prototype._run=function(t){var n=t.fn,e=t.promise;return T(this,void 0,void 0,(function(){var t,r;return j(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,n()];case 1:return t=o.sent(),e.resolve(t),[3,3];case 2:return r=o.sent(),e.reject(r),[3,3];case 3:return[2]}}))}))},t.prototype.run=function(){return T(this,void 0,void 0,(function(){var t;return j(this,(function(n){switch(n.label){case 0:return this.cache.length<1?(this.running=!1,[2]):(this.running=!0,"function"!=typeof(t=this.cache.shift()).fn?[3,2]:[4,this._run(t)]);case 1:n.sent(),n.label=2;case 2:return this.run(),[2]}}))}))},t.prototype.push=function(t){var n=this;return new Promise((function(e,r){n.cache.push({fn:t,promise:{resolve:e,reject:r}}),n.running||n.run()}))},Object.defineProperty(t.prototype,"length",{get:function(){return this.cache.length},enumerable:!1,configurable:!0}),t}(),O=function(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,o,i=e.call(t),u=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)u.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return u},_=function(){for(var t=[],n=0;n<arguments.length;n++)t=t.concat(O(arguments[n]));return t};function E(t,n){var e,r=!0;return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];e||(e=setTimeout((function(){r=!0,e=null}),n)),r&&(r=!1,t.apply(void 0,_(o)))}}var A=function(){function t(t){this._count=0,this.props=t}return Object.defineProperty(t.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),t.prototype.increment=function(){var t=this;clearTimeout(this.timeout),this.timeout=setTimeout((function(){return t.clear()}),this.props.resetTime),this._count=this._count+1,this._count>this.props.count&&this.props.cb()},t.prototype.clear=function(){this._count=0},t}(),M=function(){for(var t={},n=0;n<64;n++)t["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(n)]=n;return t}();function G(t,n){for(var e=0,r=0,o=0,i=0;i<t.length&&o<n.length;i+=1)if(r=(r<<6)+M[t.charAt(i)],(e+=6)>=8){var u=r>>>(e-=8);n[o++]=255&u,r-=u<<=e}}var I=function(){function t(t){void 0===t&&(t=10),this.stack=[],this.len=10,this.point=0,this.len=t}return Object.defineProperty(t.prototype,"current",{get:function(){if(this.point<this.stack.length&&this.point>-1)return this.stack[this.point]},enumerable:!1,configurable:!0}),t.prototype.clear=function(){this.stack.length=0,this.point=0},t.prototype.backup=function(t){this.point>0&&this.stack.length>0&&(this.stack.splice(0,this.point),this.point=0),this.stack.unshift(t),this.stack.length>this.len&&this.stack.pop()},t.prototype.undo=function(){return this.point<this.stack.length-2&&(this.point+=1),this.current},t.prototype.redo=function(){return this.point>1&&(this.point-=1),this.current},t}()}])}));
|
|
1
|
+
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports["pubo-utils"]=n():t["pubo-utils"]=n()}(this,(function(){return function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(r,o,function(n){return t[n]}.bind(null,o));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=0)}([function(t,n,e){"use strict";e.r(n),e.d(n,"debounce",(function(){return u})),e.d(n,"hex2rgb",(function(){return c})),e.d(n,"Emitter",(function(){return h})),e.d(n,"superFactory",(function(){return y})),e.d(n,"loop",(function(){return w})),e.d(n,"waitFor",(function(){return x})),e.d(n,"SyncQueue",(function(){return T})),e.d(n,"random",(function(){return a})),e.d(n,"sleep",(function(){return b})),e.d(n,"throttle",(function(){return O})),e.d(n,"ContinuousTrigger",(function(){return _})),e.d(n,"Base64Utils",(function(){return r})),e.d(n,"HistoryStack",(function(){return M})),e.d(n,"WatchDog",(function(){return G}));var r={};e.r(r),e.d(r,"EncoderMap",(function(){return E})),e.d(r,"toUnit8Array",(function(){return A}));var o=function(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,o,i=e.call(t),u=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)u.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return u},i=function(){for(var t=[],n=0;n<arguments.length;n++)t=t.concat(o(arguments[n]));return t},u=function(t,n,e){if(void 0===e&&(e=!1),e){var r,o=!0;return function(){for(var e=[],u=0;u<arguments.length;u++)e[u]=arguments[u];o&&(t.apply(void 0,i(e)),o=!1),r&&clearTimeout(r),r=setTimeout((function(){return o=!0}),n)}}var u;return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];u&&clearTimeout(u),u=setTimeout((function(){return t.apply(void 0,i(e))}),n)}},c=function(t){var n=t.toString(2).padStart(24,0);return[parseInt(n.slice(0,8),2),parseInt(n.slice(8,16),2),parseInt(n.slice(16,24),2)]},a=function(t){void 0===t&&(t=8);var n=function(t){return Math.random().toString(32).slice(2,2+t)};if(t<=8)return n(t);for(var e="",r=0;r<=t;r+=8)e+=n(t-r>8?8:t-r);return e},f=function(t){var n="function"==typeof Symbol&&Symbol.iterator,e=n&&t[n],r=0;if(e)return e.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},l=function(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,o,i=e.call(t),u=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)u.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return u},s=function(){for(var t=[],n=0;n<arguments.length;n++)t=t.concat(l(arguments[n]));return t},h=function(){function t(){this.state={},this.ids={}}return t.prototype.on=function(t,n){if(this.state[t]||(this.state[t]=[]),"function"!=typeof n)throw new Error("第二个参数必须为function!");var e=this.state[t].push(n)-1,r=a(40);return this.ids[r]={event:t,index:e},r},t.prototype.cancel=function(t){if(t){var n=this.ids[t]||{},e=n.event,r=n.index;e&&Array.isArray(this.state[e])&&this.state[e].splice(r,1)}else this.clear()},t.prototype.clear=function(){this.state.length=0},t.prototype.emit=function(t){for(var n,e,r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];if(Array.isArray(this.state[t]))try{for(var i=f(this.state[t]),u=i.next();!u.done;u=i.next()){var c=u.value;"function"==typeof c&&c.apply(void 0,s(r))}}catch(t){n={error:t}}finally{try{u&&!u.done&&(e=i.return)&&e.call(i)}finally{if(n)throw n.error}}},t}(),p=function(t){var n="function"==typeof Symbol&&Symbol.iterator,e=n&&t[n],r=0;if(e)return e.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},y=function(t){return function(n){var e,r,o={};try{for(var i=p(Object.keys(n)),u=i.next();!u.done;u=i.next()){var c=u.value;o[c]=t(n[c],c)}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return o}},d=function(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function c(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){var n;t.done?o(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(u,c)}a((r=r.apply(t,n||[])).next())}))},v=function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(e)throw new TypeError("Generator is already executing.");for(;u;)try{if(e=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=n.call(t,u)}catch(t){i=[6,t],r=0}finally{e=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},b=function(t){return d(void 0,void 0,void 0,(function(){return v(this,(function(n){switch(n.label){case 0:return[4,new Promise((function(n){return setTimeout((function(){return n()}),t)}))];case 1:return n.sent(),[2]}}))}))},m=function(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function c(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){var n;t.done?o(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(u,c)}a((r=r.apply(t,n||[])).next())}))},g=function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(e)throw new TypeError("Generator is already executing.");for(;u;)try{if(e=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=n.call(t,u)}catch(t){i=[6,t],r=0}finally{e=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},w=function(t,n){var e=!0,r=function(){e=!1},o=function(){return m(void 0,void 0,void 0,(function(){return g(this,(function(i){switch(i.label){case 0:return[4,t(r)];case 1:return i.sent(),[4,b(n)];case 2:return i.sent(),e?o():o=null,[2]}}))}))};return o(),r},x=function(t,n){var e=void 0===n?{}:n,r=e.checkTime,o=e.timeout;return new Promise((function(n,e){var i=w((function(){return m(void 0,void 0,void 0,(function(){var e;return g(this,(function(r){switch(r.label){case 0:return[4,t()];case 1:return(e=r.sent())&&(i(),n(e)),[2]}}))}))}),r||100);o&&setTimeout((function(){i(),e("timeout")}),o)}))},S=function(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function c(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){var n;t.done?o(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(u,c)}a((r=r.apply(t,n||[])).next())}))},k=function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(e)throw new TypeError("Generator is already executing.");for(;u;)try{if(e=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=n.call(t,u)}catch(t){i=[6,t],r=0}finally{e=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},T=function(){function t(){this.cache=[],this.running=!1}return t.prototype._run=function(t){var n=t.fn,e=t.promise;return S(this,void 0,void 0,(function(){var t,r;return k(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,n()];case 1:return t=o.sent(),e.resolve(t),[3,3];case 2:return r=o.sent(),e.reject(r),[3,3];case 3:return[2]}}))}))},t.prototype.run=function(){return S(this,void 0,void 0,(function(){var t;return k(this,(function(n){switch(n.label){case 0:return this.cache.length<1?(this.running=!1,[2]):(this.running=!0,"function"!=typeof(t=this.cache.shift()).fn?[3,2]:[4,this._run(t)]);case 1:n.sent(),n.label=2;case 2:return this.run(),[2]}}))}))},t.prototype.push=function(t){var n=this;return new Promise((function(e,r){n.cache.push({fn:t,promise:{resolve:e,reject:r}}),n.running||n.run()}))},Object.defineProperty(t.prototype,"length",{get:function(){return this.cache.length},enumerable:!1,configurable:!0}),t}(),j=function(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,o,i=e.call(t),u=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)u.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return u},P=function(){for(var t=[],n=0;n<arguments.length;n++)t=t.concat(j(arguments[n]));return t};function O(t,n){var e,r=!0;return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];e||(e=setTimeout((function(){r=!0,e=null}),n)),r&&(r=!1,t.apply(void 0,P(o)))}}var _=function(){function t(t){this._count=0,this.props=t}return Object.defineProperty(t.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),t.prototype.increment=function(){var t=this;clearTimeout(this.timeout),this.timeout=setTimeout((function(){return t.clear()}),this.props.resetTime),this._count=this._count+1,this._count>this.props.count&&this.props.cb()},t.prototype.clear=function(){this._count=0},t}(),E=function(){for(var t={},n=0;n<64;n++)t["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(n)]=n;return t}();function A(t,n){for(var e=0,r=0,o=0,i=0;i<t.length&&o<n.length;i+=1)if(r=(r<<6)+E[t.charAt(i)],(e+=6)>=8){var u=r>>>(e-=8);n[o++]=255&u,r-=u<<=e}}var M=function(){function t(t){void 0===t&&(t=10),this.stack=[],this.len=10,this.point=0,this.len=t}return Object.defineProperty(t.prototype,"current",{get:function(){if(this.point<this.stack.length&&this.point>-1)return this.stack[this.point]},enumerable:!1,configurable:!0}),t.prototype.clear=function(){this.stack.length=0,this.point=0},t.prototype.backup=function(t){this.point>0&&this.stack.length>0&&(this.stack.splice(0,this.point),this.point=0),this.stack.unshift(t),this.stack.length>this.len&&this.stack.pop()},t.prototype.undo=function(){return this.point<this.stack.length-2&&(this.point+=1),this.current},t.prototype.redo=function(){return this.point>1&&(this.point-=1),this.current},t}(),G=function(){function t(t){var n=t.limit,e=void 0===n?10:n,r=t.onTimeout;this.limit=10,this.timeout=null,this.limit=e,this.onTimeout=r}return t.prototype.feed=function(){clearTimeout(this.timeout),this.init()},t.prototype.init=function(){var t=this;this.timeout=setTimeout((function(){return t.onTimeout()}),1e3*this.limit)},t}()}])}));
|
package/es/emitter/index.d.ts
CHANGED
package/es/emitter/index.js
CHANGED
|
@@ -1,146 +1,3 @@
|
|
|
1
|
-
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) {
|
|
3
|
-
return value instanceof P ? value : new P(function (resolve) {
|
|
4
|
-
resolve(value);
|
|
5
|
-
});
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
|
-
function fulfilled(value) {
|
|
10
|
-
try {
|
|
11
|
-
step(generator.next(value));
|
|
12
|
-
} catch (e) {
|
|
13
|
-
reject(e);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function rejected(value) {
|
|
18
|
-
try {
|
|
19
|
-
step(generator["throw"](value));
|
|
20
|
-
} catch (e) {
|
|
21
|
-
reject(e);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function step(result) {
|
|
26
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
var __generator = this && this.__generator || function (thisArg, body) {
|
|
34
|
-
var _ = {
|
|
35
|
-
label: 0,
|
|
36
|
-
sent: function sent() {
|
|
37
|
-
if (t[0] & 1) throw t[1];
|
|
38
|
-
return t[1];
|
|
39
|
-
},
|
|
40
|
-
trys: [],
|
|
41
|
-
ops: []
|
|
42
|
-
},
|
|
43
|
-
f,
|
|
44
|
-
y,
|
|
45
|
-
t,
|
|
46
|
-
g;
|
|
47
|
-
return g = {
|
|
48
|
-
next: verb(0),
|
|
49
|
-
"throw": verb(1),
|
|
50
|
-
"return": verb(2)
|
|
51
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
52
|
-
return this;
|
|
53
|
-
}), g;
|
|
54
|
-
|
|
55
|
-
function verb(n) {
|
|
56
|
-
return function (v) {
|
|
57
|
-
return step([n, v]);
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function step(op) {
|
|
62
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
63
|
-
|
|
64
|
-
while (_) {
|
|
65
|
-
try {
|
|
66
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
67
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
68
|
-
|
|
69
|
-
switch (op[0]) {
|
|
70
|
-
case 0:
|
|
71
|
-
case 1:
|
|
72
|
-
t = op;
|
|
73
|
-
break;
|
|
74
|
-
|
|
75
|
-
case 4:
|
|
76
|
-
_.label++;
|
|
77
|
-
return {
|
|
78
|
-
value: op[1],
|
|
79
|
-
done: false
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
case 5:
|
|
83
|
-
_.label++;
|
|
84
|
-
y = op[1];
|
|
85
|
-
op = [0];
|
|
86
|
-
continue;
|
|
87
|
-
|
|
88
|
-
case 7:
|
|
89
|
-
op = _.ops.pop();
|
|
90
|
-
|
|
91
|
-
_.trys.pop();
|
|
92
|
-
|
|
93
|
-
continue;
|
|
94
|
-
|
|
95
|
-
default:
|
|
96
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
97
|
-
_ = 0;
|
|
98
|
-
continue;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
102
|
-
_.label = op[1];
|
|
103
|
-
break;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
107
|
-
_.label = t[1];
|
|
108
|
-
t = op;
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (t && _.label < t[2]) {
|
|
113
|
-
_.label = t[2];
|
|
114
|
-
|
|
115
|
-
_.ops.push(op);
|
|
116
|
-
|
|
117
|
-
break;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if (t[2]) _.ops.pop();
|
|
121
|
-
|
|
122
|
-
_.trys.pop();
|
|
123
|
-
|
|
124
|
-
continue;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
op = body.call(thisArg, _);
|
|
128
|
-
} catch (e) {
|
|
129
|
-
op = [6, e];
|
|
130
|
-
y = 0;
|
|
131
|
-
} finally {
|
|
132
|
-
f = t = 0;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if (op[0] & 5) throw op[1];
|
|
137
|
-
return {
|
|
138
|
-
value: op[0] ? op[1] : void 0,
|
|
139
|
-
done: true
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
|
|
144
1
|
var __values = this && this.__values || function (o) {
|
|
145
2
|
var s = typeof Symbol === "function" && Symbol.iterator,
|
|
146
3
|
m = s && o[s],
|
|
@@ -247,86 +104,35 @@ function () {
|
|
|
247
104
|
};
|
|
248
105
|
|
|
249
106
|
Emitter.prototype.emit = function (event) {
|
|
107
|
+
var e_1, _a;
|
|
108
|
+
|
|
250
109
|
var args = [];
|
|
251
110
|
|
|
252
111
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
253
112
|
args[_i - 1] = arguments[_i];
|
|
254
113
|
}
|
|
255
114
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
return __generator(this, function (_d) {
|
|
262
|
-
switch (_d.label) {
|
|
263
|
-
case 0:
|
|
264
|
-
if (!Array.isArray(this.state[event])) return [3
|
|
265
|
-
/*break*/
|
|
266
|
-
, 8];
|
|
267
|
-
_d.label = 1;
|
|
268
|
-
|
|
269
|
-
case 1:
|
|
270
|
-
_d.trys.push([1, 6, 7, 8]);
|
|
271
|
-
|
|
272
|
-
_a = __values(this.state[event]), _b = _a.next();
|
|
273
|
-
_d.label = 2;
|
|
274
|
-
|
|
275
|
-
case 2:
|
|
276
|
-
if (!!_b.done) return [3
|
|
277
|
-
/*break*/
|
|
278
|
-
, 5];
|
|
279
|
-
func = _b.value;
|
|
280
|
-
if (!(typeof func === 'function')) return [3
|
|
281
|
-
/*break*/
|
|
282
|
-
, 4];
|
|
283
|
-
return [4
|
|
284
|
-
/*yield*/
|
|
285
|
-
, func.apply(void 0, __spread(args))];
|
|
286
|
-
|
|
287
|
-
case 3:
|
|
288
|
-
_d.sent();
|
|
289
|
-
|
|
290
|
-
_d.label = 4;
|
|
291
|
-
|
|
292
|
-
case 4:
|
|
293
|
-
_b = _a.next();
|
|
294
|
-
return [3
|
|
295
|
-
/*break*/
|
|
296
|
-
, 2];
|
|
297
|
-
|
|
298
|
-
case 5:
|
|
299
|
-
return [3
|
|
300
|
-
/*break*/
|
|
301
|
-
, 8];
|
|
302
|
-
|
|
303
|
-
case 6:
|
|
304
|
-
e_1_1 = _d.sent();
|
|
305
|
-
e_1 = {
|
|
306
|
-
error: e_1_1
|
|
307
|
-
};
|
|
308
|
-
return [3
|
|
309
|
-
/*break*/
|
|
310
|
-
, 8];
|
|
311
|
-
|
|
312
|
-
case 7:
|
|
313
|
-
try {
|
|
314
|
-
if (_b && !_b.done && (_c = _a["return"])) _c.call(_a);
|
|
315
|
-
} finally {
|
|
316
|
-
if (e_1) throw e_1.error;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
return [7
|
|
320
|
-
/*endfinally*/
|
|
321
|
-
];
|
|
115
|
+
if (Array.isArray(this.state[event])) {
|
|
116
|
+
try {
|
|
117
|
+
for (var _b = __values(this.state[event]), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
118
|
+
var func = _c.value;
|
|
322
119
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
];
|
|
120
|
+
if (typeof func === 'function') {
|
|
121
|
+
func.apply(void 0, __spread(args));
|
|
122
|
+
}
|
|
327
123
|
}
|
|
328
|
-
})
|
|
329
|
-
|
|
124
|
+
} catch (e_1_1) {
|
|
125
|
+
e_1 = {
|
|
126
|
+
error: e_1_1
|
|
127
|
+
};
|
|
128
|
+
} finally {
|
|
129
|
+
try {
|
|
130
|
+
if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
|
|
131
|
+
} finally {
|
|
132
|
+
if (e_1) throw e_1.error;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
330
136
|
};
|
|
331
137
|
|
|
332
138
|
return Emitter;
|
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED
|
@@ -10,4 +10,5 @@ export { throttle } from './throttle';
|
|
|
10
10
|
export { ContinuousTrigger } from './trigger';
|
|
11
11
|
import * as _Base64Utils from './base64';
|
|
12
12
|
export { _Base64Utils as Base64Utils };
|
|
13
|
-
export { HistoryStack } from './stack';
|
|
13
|
+
export { HistoryStack } from './stack';
|
|
14
|
+
export { WatchDog } from './watch-dog';
|
package/lib/emitter/index.d.ts
CHANGED
package/lib/emitter/index.js
CHANGED
|
@@ -1,148 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
4
|
-
function adopt(value) {
|
|
5
|
-
return value instanceof P ? value : new P(function (resolve) {
|
|
6
|
-
resolve(value);
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11
|
-
function fulfilled(value) {
|
|
12
|
-
try {
|
|
13
|
-
step(generator.next(value));
|
|
14
|
-
} catch (e) {
|
|
15
|
-
reject(e);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function rejected(value) {
|
|
20
|
-
try {
|
|
21
|
-
step(generator["throw"](value));
|
|
22
|
-
} catch (e) {
|
|
23
|
-
reject(e);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function step(result) {
|
|
28
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
var __generator = this && this.__generator || function (thisArg, body) {
|
|
36
|
-
var _ = {
|
|
37
|
-
label: 0,
|
|
38
|
-
sent: function sent() {
|
|
39
|
-
if (t[0] & 1) throw t[1];
|
|
40
|
-
return t[1];
|
|
41
|
-
},
|
|
42
|
-
trys: [],
|
|
43
|
-
ops: []
|
|
44
|
-
},
|
|
45
|
-
f,
|
|
46
|
-
y,
|
|
47
|
-
t,
|
|
48
|
-
g;
|
|
49
|
-
return g = {
|
|
50
|
-
next: verb(0),
|
|
51
|
-
"throw": verb(1),
|
|
52
|
-
"return": verb(2)
|
|
53
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
54
|
-
return this;
|
|
55
|
-
}), g;
|
|
56
|
-
|
|
57
|
-
function verb(n) {
|
|
58
|
-
return function (v) {
|
|
59
|
-
return step([n, v]);
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function step(op) {
|
|
64
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
65
|
-
|
|
66
|
-
while (_) {
|
|
67
|
-
try {
|
|
68
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
69
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
70
|
-
|
|
71
|
-
switch (op[0]) {
|
|
72
|
-
case 0:
|
|
73
|
-
case 1:
|
|
74
|
-
t = op;
|
|
75
|
-
break;
|
|
76
|
-
|
|
77
|
-
case 4:
|
|
78
|
-
_.label++;
|
|
79
|
-
return {
|
|
80
|
-
value: op[1],
|
|
81
|
-
done: false
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
case 5:
|
|
85
|
-
_.label++;
|
|
86
|
-
y = op[1];
|
|
87
|
-
op = [0];
|
|
88
|
-
continue;
|
|
89
|
-
|
|
90
|
-
case 7:
|
|
91
|
-
op = _.ops.pop();
|
|
92
|
-
|
|
93
|
-
_.trys.pop();
|
|
94
|
-
|
|
95
|
-
continue;
|
|
96
|
-
|
|
97
|
-
default:
|
|
98
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
99
|
-
_ = 0;
|
|
100
|
-
continue;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
104
|
-
_.label = op[1];
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
109
|
-
_.label = t[1];
|
|
110
|
-
t = op;
|
|
111
|
-
break;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
if (t && _.label < t[2]) {
|
|
115
|
-
_.label = t[2];
|
|
116
|
-
|
|
117
|
-
_.ops.push(op);
|
|
118
|
-
|
|
119
|
-
break;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (t[2]) _.ops.pop();
|
|
123
|
-
|
|
124
|
-
_.trys.pop();
|
|
125
|
-
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
op = body.call(thisArg, _);
|
|
130
|
-
} catch (e) {
|
|
131
|
-
op = [6, e];
|
|
132
|
-
y = 0;
|
|
133
|
-
} finally {
|
|
134
|
-
f = t = 0;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if (op[0] & 5) throw op[1];
|
|
139
|
-
return {
|
|
140
|
-
value: op[0] ? op[1] : void 0,
|
|
141
|
-
done: true
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
|
|
146
3
|
var __values = this && this.__values || function (o) {
|
|
147
4
|
var s = typeof Symbol === "function" && Symbol.iterator,
|
|
148
5
|
m = s && o[s],
|
|
@@ -254,86 +111,35 @@ function () {
|
|
|
254
111
|
};
|
|
255
112
|
|
|
256
113
|
Emitter.prototype.emit = function (event) {
|
|
114
|
+
var e_1, _a;
|
|
115
|
+
|
|
257
116
|
var args = [];
|
|
258
117
|
|
|
259
118
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
260
119
|
args[_i - 1] = arguments[_i];
|
|
261
120
|
}
|
|
262
121
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
return __generator(this, function (_d) {
|
|
269
|
-
switch (_d.label) {
|
|
270
|
-
case 0:
|
|
271
|
-
if (!Array.isArray(this.state[event])) return [3
|
|
272
|
-
/*break*/
|
|
273
|
-
, 8];
|
|
274
|
-
_d.label = 1;
|
|
275
|
-
|
|
276
|
-
case 1:
|
|
277
|
-
_d.trys.push([1, 6, 7, 8]);
|
|
278
|
-
|
|
279
|
-
_a = __values(this.state[event]), _b = _a.next();
|
|
280
|
-
_d.label = 2;
|
|
281
|
-
|
|
282
|
-
case 2:
|
|
283
|
-
if (!!_b.done) return [3
|
|
284
|
-
/*break*/
|
|
285
|
-
, 5];
|
|
286
|
-
func = _b.value;
|
|
287
|
-
if (!(typeof func === 'function')) return [3
|
|
288
|
-
/*break*/
|
|
289
|
-
, 4];
|
|
290
|
-
return [4
|
|
291
|
-
/*yield*/
|
|
292
|
-
, func.apply(void 0, __spread(args))];
|
|
293
|
-
|
|
294
|
-
case 3:
|
|
295
|
-
_d.sent();
|
|
296
|
-
|
|
297
|
-
_d.label = 4;
|
|
298
|
-
|
|
299
|
-
case 4:
|
|
300
|
-
_b = _a.next();
|
|
301
|
-
return [3
|
|
302
|
-
/*break*/
|
|
303
|
-
, 2];
|
|
304
|
-
|
|
305
|
-
case 5:
|
|
306
|
-
return [3
|
|
307
|
-
/*break*/
|
|
308
|
-
, 8];
|
|
309
|
-
|
|
310
|
-
case 6:
|
|
311
|
-
e_1_1 = _d.sent();
|
|
312
|
-
e_1 = {
|
|
313
|
-
error: e_1_1
|
|
314
|
-
};
|
|
315
|
-
return [3
|
|
316
|
-
/*break*/
|
|
317
|
-
, 8];
|
|
318
|
-
|
|
319
|
-
case 7:
|
|
320
|
-
try {
|
|
321
|
-
if (_b && !_b.done && (_c = _a["return"])) _c.call(_a);
|
|
322
|
-
} finally {
|
|
323
|
-
if (e_1) throw e_1.error;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
return [7
|
|
327
|
-
/*endfinally*/
|
|
328
|
-
];
|
|
122
|
+
if (Array.isArray(this.state[event])) {
|
|
123
|
+
try {
|
|
124
|
+
for (var _b = __values(this.state[event]), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
125
|
+
var func = _c.value;
|
|
329
126
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
];
|
|
127
|
+
if (typeof func === 'function') {
|
|
128
|
+
func.apply(void 0, __spread(args));
|
|
129
|
+
}
|
|
334
130
|
}
|
|
335
|
-
})
|
|
336
|
-
|
|
131
|
+
} catch (e_1_1) {
|
|
132
|
+
e_1 = {
|
|
133
|
+
error: e_1_1
|
|
134
|
+
};
|
|
135
|
+
} finally {
|
|
136
|
+
try {
|
|
137
|
+
if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
|
|
138
|
+
} finally {
|
|
139
|
+
if (e_1) throw e_1.error;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
337
143
|
};
|
|
338
144
|
|
|
339
145
|
return Emitter;
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -142,4 +142,13 @@ Object.defineProperty(exports, "HistoryStack", {
|
|
|
142
142
|
get: function get() {
|
|
143
143
|
return stack_1.HistoryStack;
|
|
144
144
|
}
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
var watch_dog_1 = require("./watch-dog");
|
|
148
|
+
|
|
149
|
+
Object.defineProperty(exports, "WatchDog", {
|
|
150
|
+
enumerable: true,
|
|
151
|
+
get: function get() {
|
|
152
|
+
return watch_dog_1.WatchDog;
|
|
153
|
+
}
|
|
145
154
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pubo-utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.37",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
"engines": {
|
|
19
19
|
"node": ">=8.0.0"
|
|
20
20
|
},
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "78eee2cbf3b652f8b4f330c9f21b7aced51c38f1"
|
|
22
22
|
}
|