@antoniovdlc/defer
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -1,1 +0,1 @@ | ||
"use strict";function e(e,r,n,t){return new(n||(n=Promise))((function(o,u){function a(e){try{i(t.next(e))}catch(e){u(e)}}function c(e){try{i(t.throw(e))}catch(e){u(e)}}function i(e){var r;e.done?o(e.value):(r=e.value,r instanceof n?r:new n((function(e){e(r)}))).then(a,c)}i((t=t.apply(e,r||[])).next())}))}function r(e,r){var n,t,o,u,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function c(u){return function(c){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,t&&(o=2&u[0]?t.return:u[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,u[1])).done)return o;switch(t=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,t=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=r.call(e,a)}catch(e){u=[6,e],t=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.defer=function(e,r){"Function"===r.constructor.name?setTimeout(e,0):"AsyncFunction"===r.constructor.name&&(Array.isArray(r.__$_deferArr)||(r.__$_deferArr=[]),r.__$_deferArr.push(e))},exports.deferrable=function(n){var t=this;return function(){return e(t,void 0,void 0,(function(){var e,t;return r(this,(function(r){switch(r.label){case 0:return[4,n()];case 1:r.sent(),e=0,t=n.__$_deferArr.length,r.label=2;case 2:return e<t?[4,n.__$_deferArr[e]()]:[3,5];case 3:r.sent(),r.label=4;case 4:return e++,[3,2];case 5:return[2]}}))}))}}; | ||
"use strict";function e(e,r,n,t){return new(n||(n=Promise))((function(o,u){function a(e){try{i(t.next(e))}catch(e){u(e)}}function c(e){try{i(t.throw(e))}catch(e){u(e)}}function i(e){var r;e.done?o(e.value):(r=e.value,r instanceof n?r:new n((function(e){e(r)}))).then(a,c)}i((t=t.apply(e,r||[])).next())}))}function r(e,r){var n,t,o,u,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function c(u){return function(c){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,t&&(o=2&u[0]?t.return:u[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,u[1])).done)return o;switch(t=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,t=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=r.call(e,a)}catch(e){u=[6,e],t=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.defer=function(e,r){"Function"===r.constructor.name?setTimeout(e,0):"AsyncFunction"===r.constructor.name&&(Array.isArray(r.__$_deferArr)||(r.__$_deferArr=[]),r.__$_deferArr.push(e))},exports.deferrable=function(n){var t=this;return function(){return e(t,void 0,void 0,(function(){var e,t,o;return r(this,(function(r){switch(r.label){case 0:return[4,n()];case 1:e=r.sent(),t=0,o=n.__$_deferArr.length,r.label=2;case 2:return t<o?[4,n.__$_deferArr[t]()]:[3,5];case 3:r.sent(),r.label=4;case 4:return t++,[3,2];case 5:return[2,e]}}))}))}}; |
@@ -1,1 +0,1 @@ | ||
function e(e,n,r,t){return new(r||(r=Promise))((function(o,u){function a(e){try{i(t.next(e))}catch(e){u(e)}}function c(e){try{i(t.throw(e))}catch(e){u(e)}}function i(e){var n;e.done?o(e.value):(n=e.value,n instanceof r?n:new r((function(e){e(n)}))).then(a,c)}i((t=t.apply(e,n||[])).next())}))}function n(e,n){var r,t,o,u,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function c(u){return function(c){return function(u){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,t&&(o=2&u[0]?t.return:u[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,u[1])).done)return o;switch(t=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,t=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=n.call(e,a)}catch(e){u=[6,e],t=0}finally{r=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}function r(e,n){"Function"===n.constructor.name?setTimeout(e,0):"AsyncFunction"===n.constructor.name&&(Array.isArray(n.__$_deferArr)||(n.__$_deferArr=[]),n.__$_deferArr.push(e))}function t(r){var t=this;return function(){return e(t,void 0,void 0,(function(){var e,t;return n(this,(function(n){switch(n.label){case 0:return[4,r()];case 1:n.sent(),e=0,t=r.__$_deferArr.length,n.label=2;case 2:return e<t?[4,r.__$_deferArr[e]()]:[3,5];case 3:n.sent(),n.label=4;case 4:return e++,[3,2];case 5:return[2]}}))}))}}export{r as defer,t as deferrable}; | ||
function e(e,n,r,t){return new(r||(r=Promise))((function(o,u){function a(e){try{i(t.next(e))}catch(e){u(e)}}function c(e){try{i(t.throw(e))}catch(e){u(e)}}function i(e){var n;e.done?o(e.value):(n=e.value,n instanceof r?n:new r((function(e){e(n)}))).then(a,c)}i((t=t.apply(e,n||[])).next())}))}function n(e,n){var r,t,o,u,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function c(u){return function(c){return function(u){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,t&&(o=2&u[0]?t.return:u[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,u[1])).done)return o;switch(t=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,t=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=n.call(e,a)}catch(e){u=[6,e],t=0}finally{r=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}function r(e,n){"Function"===n.constructor.name?setTimeout(e,0):"AsyncFunction"===n.constructor.name&&(Array.isArray(n.__$_deferArr)||(n.__$_deferArr=[]),n.__$_deferArr.push(e))}function t(r){var t=this;return function(){return e(t,void 0,void 0,(function(){var e,t,o;return n(this,(function(n){switch(n.label){case 0:return[4,r()];case 1:e=n.sent(),t=0,o=r.__$_deferArr.length,n.label=2;case 2:return t<o?[4,r.__$_deferArr[t]()]:[3,5];case 3:n.sent(),n.label=4;case 4:return t++,[3,2];case 5:return[2,e]}}))}))}}export{r as defer,t as deferrable}; |
{ | ||
"name": "@antoniovdlc/defer", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Go-like defer functions in JavaScript.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js", |
11662