-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathchillout.min.js
7 lines (7 loc) · 5.44 KB
/
chillout.min.js
1
2
3
4
5
6
7
/*!
* chillout v5.0.0 - Reduce CPU usage by non-blocking async loop and psychologically speed up in JavaScript
* Copyright (c) 2017-2021 polygon planet <polygon.planet.aqua@gmail.com>
* https://github.com/polygonplanet/chillout
* @license MIT
*/
!function(t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).chillout=t()}(function(){return function r(o,i,u){function f(n,t){if(!i[n]){if(!o[n]){var e="function"==typeof require&&require;if(!t&&e)return e(n,!0);if(c)return c(n,!0);throw(e=new Error("Cannot find module '"+n+"'")).code="MODULE_NOT_FOUND",e}e=i[n]={exports:{}},o[n][0].call(e.exports,function(t){return f(o[n][1][t]||t)},e,e.exports,r,o,i,u)}return i[n].exports}for(var c="function"==typeof require&&require,t=0;t<u.length;t++)f(u[t]);return f}({1:[function(t,n,e){n.exports={version:"5.0.0"}},{}],2:[function(t,n,e){"use strict";var r=t("./iterator"),o=t("./iterate"),i=t("./util"),u=i.isThenable,f=i.isArrayLike,c=t("./next-tick"),i=t("./stop-iteration");e.version=t("../package.json").version,e.forEach=function(t,n,e){return o(r.forEach(t,n,e))},e.repeat=function(t,n,e){return o(r.repeat(t,n,e))},e.until=function(t,n){return o(r.until(t,n))};e.waitUntil=function(t,n){return o(r.until(t,n),13)},e.forOf=function(t,n,e){return o(r.forOf(t,n,e))},e.StopIteration=i,e.iterate=o,e.iterator=r,e.isThenable=u,e.isArrayLike=f,e.nextTick=c},{"../package.json":1,"./iterate":3,"./iterator":4,"./next-tick":5,"./stop-iteration":6,"./util":7}],3:[function(t,n,e){"use strict";function l(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var e=[],r=!0,o=!1,i=void 0;try{for(var u,f=t[Symbol.iterator]();!(r=(u=f.next()).done)&&(e.push(u.value),!n||e.length!==n);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==f.return||f.return()}finally{if(o)throw i}}return e}(t,n)||function(t,n){if(!t)return;if("string"==typeof t)return r(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);"Object"===e&&t.constructor&&(e=t.constructor.name);if("Map"===e||"Set"===e)return Array.from(t);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return r(t,n)}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e<n;e++)r[e]=t[e];return r}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var y=t("./util").isThenable,p=t("./stop-iteration"),b=t("./next-tick");n.exports=function(c){var a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return new Promise(function(i,u){var f=0;b(function e(){var r,t,o=Date.now();try{for(;;){var n=function(){var t=l(c.next(),2),n=t[0],t=t[1];return y(t)?(t.then(function(t){n?i(t):(t===p?i:e)()},u),{v:void 0}):n?(i(t),{v:void 0}):t===p?(i(),{v:void 0}):0<a?"break":(t=Date.now(),!(1e3<(f+=r=t-o))&&r<10?"continue":"break")}();if("break"===n)break;if("continue"!==n&&"object"===s(n))return n.v}}catch(t){return void u(t)}0<a?(t=Math.min(1500,Date.now()-o+a),setTimeout(e,t)):(t=Math.min(1500,r/3),f=0,10<t?setTimeout(e,t):b(e))})})}},{"./next-tick":5,"./stop-iteration":6,"./util":7}],4:[function(t,n,e){"use strict";function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var f=t("./util").isArrayLike;e.forEach=function(n,e,r){var o=0;if(f(n))return u=n.length,{next:function(){if(u<=o)return[!0,null];var t=e.call(r,n[o],o,n);return o++,[!1,t]}};var i=Object.keys(n),u=i.length;return{next:function(){if(u<=o)return[!0,null];var t=i[o++];return[!1,e.call(r,n[t],t,n)]}}},e.repeat=function(t,n,e){var r,o,i=t&&"object"===u(t)?(r=t.start||0,o=t.step||1,t.done):(r=0,o=1,t);return{next:function(){var t=n.call(e,r);return i<=(r+=o)?[!0,t]:[!1,t]}}},e.until=function(t,n){return{next:function(){return[!1,t.call(n)]}}},e.forOf=function(n,e,r){var o=n[Symbol.iterator]();return{next:function(){var t=o.next();return t.done?[!0,null]:[!1,e.call(r,t.value,n)]}}}},{"./util":7}],5:[function(t,n,e){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var r=function(){if("function"==typeof setImmediate)return function(t){setImmediate(t)};if("object"===("undefined"==typeof process?"undefined":o(process))&&"function"==typeof process.nextTick)return function(t){process.nextTick(t)};if("function"!=typeof MessageChannel)return function(t){setTimeout(t,0)};var n=new MessageChannel,e={},r=e;return n.port1.onmessage=function(){var t=(e=e.next).task;delete e.task,t()},function(t){r=r.next={task:t},n.port2.postMessage(0)}}();n.exports=r},{}],6:[function(t,n,e){"use strict";n.exports={}},{}],7:[function(t,n,e){"use strict";e.isThenable=function(t){return null!=t&&"function"==typeof t.then},e.isArrayLike=function(t){return null!=t&&"number"==typeof t.length&&0<=t.length}},{}]},{},[2])(2)});