Socket
Book a DemoInstallSign in
Socket

async-poll

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-poll - npm Package Compare versions

Comparing version

to
1.4.2-1

2

dist/async-poll.iife.js

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

var AsyncPoll=function(e){"use strict";function t(e,t,n,r){return new(n||(n=Promise))(function(o,a){function l(e){try{i(r.next(e))}catch(e){a(e)}}function u(e){try{i(r.throw(e))}catch(e){a(e)}}function i(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(l,u)}i((r=r.apply(e,t||[])).next())})}function n(e,t){var n,r,o,a,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;l;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return l.label++,{value:a[1],done:!1};case 5:l.label++,r=a[1],a=[0];continue;case 7:a=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){l=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){l.label=a[1];break}if(6===a[0]&&l.label<o[1]){l.label=o[1],o=a;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(a);break}o[2]&&l.ops.pop(),l.trys.pop();continue}a=t.call(e,l)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function r(){return t(this,void 0,void 0,function(){var e;return n(this,function(t){switch(t.label){case 0:return"undefined"==typeof window?[3,1]:(e=window.performance,[3,3]);case 1:return[4,import("perf_hooks")];case 2:e=t.sent().performance,t.label=3;case 3:return[2,e]}})})}var o=window,a=function(e){return t(o,void 0,void 0,function(){return n(this,function(t){return[2,new Promise(function(t){return e<1?t():setTimeout(t,e)})]})})};function l(e,o,l){return t(this,void 0,void 0,function(){var t,u,i,s,c,f,p,d,b,h,w,v,m,y;return n(this,function(n){switch(n.label){case 0:if(u=(t=l||{}).interval,i=t.timeout,"number"!=typeof u||u<0)throw new TypeError("Expected 'interval' to be a valid number, but received '"+u+"'");if("number"!=typeof i)throw new TypeError("Expected 'timeout' to be a valid number, but received '"+i+"'");n.label=1;case 1:return n.trys.push([1,8,,9]),[4,r()];case 2:s=n.sent(),c=+u,f=+i,p=i<1,d=void 0,b=0,h=0,w=0,v=0,m=!1,s.mark("poll starts"),n.label=3;case 3:return s.mark("poll "+v+" starts"),b=s.now(),[4,e()];case 4:return d=n.sent(),s.mark("poll "+v+" ends"),h=s.now(),y=Math.ceil(h-b),m=!!p||w<f&&!o(d),w+=y>c?y:c,s.measure("poll "+v+" takes","poll "+v+" starts","poll "+v+" ends"),m?[4,a(c-y)]:[3,7];case 5:n.sent(),s.mark("next poll starts"),s.measure("poll "+(v+1)+" starts after","poll "+v+" ends","next poll starts"),v+=1,n.label=6;case 6:if(m)return[3,3];n.label=7;case 7:return s.mark("poll ends"),s.measure("poll spent","poll starts","poll ends"),[2,d];case 8:throw n.sent();case 9:return[2]}})})}return e.asyncPoll=l,e.default=l,e}({});
var AsyncPoll=function(e){"use strict";function t(e,t,n,r){return new(n||(n=Promise))(function(o,a){function l(e){try{s(r.next(e))}catch(e){a(e)}}function u(e){try{s(r.throw(e))}catch(e){a(e)}}function s(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(l,u)}s((r=r.apply(e,t||[])).next())})}function n(e,t){var n,r,o,a,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;l;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return l.label++,{value:a[1],done:!1};case 5:l.label++,r=a[1],a=[0];continue;case 7:a=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){l=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){l.label=a[1];break}if(6===a[0]&&l.label<o[1]){l.label=o[1],o=a;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(a);break}o[2]&&l.ops.pop(),l.trys.pop();continue}a=t.call(e,l)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function r(){return t(this,void 0,void 0,function(){var e;return n(this,function(t){switch(t.label){case 0:return"undefined"==typeof window?[3,1]:(e=window.performance,[3,3]);case 1:return[4,import("perf_hooks")];case 2:e=t.sent().performance,t.label=3;case 3:return[2,e]}})})}function o(e){return t(this,void 0,void 0,function(){return n(this,function(t){return[2,new Promise(function(t){return e<1?process.nextTick(t):setTimeout(t,e)})]})})}function a(e,a,l){return t(this,void 0,void 0,function(){var t,u,s,i,c,f,p,d,b,h,w,v,m,y;return n(this,function(n){switch(n.label){case 0:if(u=(t=l||{}).interval,s=t.timeout,"number"!=typeof u||u<0)throw new TypeError("Expected 'interval' to be a valid number, but received '"+u+"'");if("number"!=typeof s)throw new TypeError("Expected 'timeout' to be a valid number, but received '"+s+"'");n.label=1;case 1:return n.trys.push([1,8,,9]),i=+u,c=+s,f=s<1,[4,r()];case 2:p=n.sent(),d=void 0,b=0,h=0,w=0,v=0,m=!1,p.mark("poll starts"),n.label=3;case 3:return p.mark("poll "+v+" starts"),b=p.now(),[4,e()];case 4:return d=n.sent(),p.mark("poll "+v+" ends"),h=p.now(),y=Math.ceil(h-b),m=!!f||w<c&&!a(d),w+=y>i?y:i,p.measure("poll "+v+" takes","poll "+v+" starts","poll "+v+" ends"),m?[4,o(i-y)]:[3,7];case 5:n.sent(),p.mark("next poll starts"),p.measure("poll "+(v+1)+" starts after","poll "+v+" ends","next poll starts"),v+=1,n.label=6;case 6:if(m)return[3,3];n.label=7;case 7:return p.mark("poll ends"),p.measure("poll spent","poll starts","poll ends"),[2,d];case 8:throw n.sent();case 9:return[2]}})})}return e.asyncPoll=a,e.default=a,e}({});
//# sourceMappingURL=async-poll.iife.js.map

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

const e=async e=>new Promise(t=>e<1?t():setTimeout(t,e));async function t(t,r,o){const{interval:a,timeout:n}=o||{};if("number"!=typeof a||a<0)throw new TypeError(`Expected 'interval' to be a valid number, but received '${a}'`);if("number"!=typeof n)throw new TypeError(`Expected 'timeout' to be a valid number, but received '${n}'`);try{const o=await async function(){return"undefined"!=typeof window?window.performance:(await import("perf_hooks")).performance}(),l=+a,s=+n,p=n<1;let i,m=0,c=0,u=0,d=0,w=!1;o.mark("poll starts");do{o.mark(`poll ${d} starts`),m=o.now(),i=await t(),o.mark(`poll ${d} ends`),c=o.now();const a=Math.ceil(c-m);if(w=!!p||u<s&&!r(i),u+=a>l?a:l,o.measure(`poll ${d} takes`,`poll ${d} starts`,`poll ${d} ends`),!w)break;await e(l-a),o.mark("next poll starts"),o.measure(`poll ${d+1} starts after`,`poll ${d} ends`,"next poll starts"),d+=1}while(w);return o.mark("poll ends"),o.measure("poll spent","poll starts","poll ends"),i}catch(e){throw e}}export default t;export{t as asyncPoll};
async function e(e){return new Promise(t=>e<1?process.nextTick(t):setTimeout(t,e))}async function t(t,r,o){const{interval:n,timeout:a}=o||{};if("number"!=typeof n||n<0)throw new TypeError(`Expected 'interval' to be a valid number, but received '${n}'`);if("number"!=typeof a)throw new TypeError(`Expected 'timeout' to be a valid number, but received '${a}'`);try{const o=+n,l=+a,s=a<1,p=await async function(){return"undefined"!=typeof window?window.performance:(await import("perf_hooks")).performance}();let i,c=0,u=0,m=0,d=0,w=!1;p.mark("poll starts");do{p.mark(`poll ${d} starts`),c=p.now(),i=await t(),p.mark(`poll ${d} ends`),u=p.now();const n=Math.ceil(u-c);if(w=!!s||m<l&&!r(i),m+=n>o?n:o,p.measure(`poll ${d} takes`,`poll ${d} starts`,`poll ${d} ends`),!w)break;await e(o-n),p.mark("next poll starts"),p.measure(`poll ${d+1} starts after`,`poll ${d} ends`,"next poll starts"),d+=1}while(w);return p.mark("poll ends"),p.measure("poll spent","poll starts","poll ends"),i}catch(e){throw e}}export default t;export{t as asyncPoll};
//# sourceMappingURL=async-poll.js.map

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var perf_hooks=require("perf_hooks");async function delay(e){return new Promise(r=>e<1?process.nextTick(r):setTimeout(r,e))}async function asyncPoll(e,r,o){const{interval:t,timeout:s}=o||{};if("number"!=typeof t||t<0)throw new TypeError(`Expected 'interval' to be a valid number, but received '${t}'`);if("number"!=typeof s)throw new TypeError(`Expected 'timeout' to be a valid number, but received '${s}'`);try{const o=+t,a=+s,l=s<1;let p,n=0,c=0,f=0,m=0,i=!1;perf_hooks.performance.mark("poll starts");do{perf_hooks.performance.mark(`poll ${m} starts`),n=perf_hooks.performance.now(),p=await e(),perf_hooks.performance.mark(`poll ${m} ends`),c=perf_hooks.performance.now();const t=Math.ceil(c-n);if(i=!!l||f<a&&!r(p),f+=t>o?t:o,perf_hooks.performance.measure(`poll ${m} takes`,`poll ${m} starts`,`poll ${m} ends`),!i)break;await delay(o-t),perf_hooks.performance.mark("next poll starts"),perf_hooks.performance.measure(`poll ${m+1} starts after`,`poll ${m} ends`,"next poll starts"),m+=1}while(i);return perf_hooks.performance.mark("poll ends"),perf_hooks.performance.measure("poll spent","poll starts","poll ends"),p}catch(e){throw e}}exports.asyncPoll=asyncPoll,exports.default=asyncPoll;
"use strict";async function globalPerformance(){return"undefined"!=typeof window?window.performance:(await Promise.resolve(require("perf_hooks"))).performance}async function delay(e){return new Promise(t=>e<1?process.nextTick(t):setTimeout(t,e))}async function asyncPoll(e,t,r){const{interval:o,timeout:l}=r||{};if("number"!=typeof o||o<0)throw new TypeError(`Expected 'interval' to be a valid number, but received '${o}'`);if("number"!=typeof l)throw new TypeError(`Expected 'timeout' to be a valid number, but received '${l}'`);try{const r=+o,a=+l,n=l<1,s=await globalPerformance();let i,p=0,c=0,u=0,d=0,m=!1;s.mark("poll starts");do{s.mark(`poll ${d} starts`),p=s.now(),i=await e(),s.mark(`poll ${d} ends`),c=s.now();const o=Math.ceil(c-p);if(m=!!n||u<a&&!t(i),u+=o>r?o:r,s.measure(`poll ${d} takes`,`poll ${d} starts`,`poll ${d} ends`),!m)break;await delay(r-o),s.mark("next poll starts"),s.measure(`poll ${d+1} starts after`,`poll ${d} ends`,"next poll starts"),d+=1}while(m);return s.mark("poll ends"),s.measure("poll spent","poll starts","poll ends"),i}catch(e){throw e}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.asyncPoll=asyncPoll,exports.default=asyncPoll;
//# sourceMappingURL=index.js.map
{
"name": "async-poll",
"version": "1.4.2-0",
"version": "1.4.2-1",
"description": "Advanced polling module with timeout and metrics collection",

@@ -5,0 +5,0 @@ "keywords": [

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

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.