doipjs/node_modules/workerpool/dist/workerpool.min.js

26 lines
18 KiB
JavaScript
Raw Normal View History

2020-10-23 14:35:53 -06:00
/**
* workerpool.js
* https://github.com/josdejong/workerpool
*
* Offload tasks to a pool of workers on node.js and in the browser.
*
* @version 6.0.2
* @date 2020-10-03
*
* @license
* Copyright (C) 2014-2020 Jos de Jong <wjosdejong@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("workerpool",[],r):"object"==typeof exports?exports.workerpool=r():e.workerpool=r()}("undefined"!=typeof self?self:this,(function(){return function(e){var r={};function t(o){if(r[o])return r[o].exports;var n=r[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,t),n.l=!0,n.exports}return t.m=e,t.c=r,t.d=function(e,r,o){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:o})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(t.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)t.d(o,n,function(r){return e[r]}.bind(null,n));return o},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=3)}([function(e,r,t){var o=t(2),n=function(e){return void 0!==e&&null!=e.versions&&null!=e.versions.node};e.exports.isNode=n,e.exports.platform="undefined"!=typeof process&&n(process)?"node":"browser";var i=function(e){try{return o(e)}catch(e){return null}}("worker_threads");e.exports.isMainThread="node"===e.exports.platform?(!i||i.isMainThread)&&!process.connected:"undefined"!=typeof Window,e.exports.cpus="browser"===e.exports.platform?self.navigator.hardwareConcurrency:o("os").cpus().length},function(e,r,t){"use strict";function o(e,r){var t=this;if(!(this instanceof o))throw new SyntaxError("Constructor must be called with the new operator");if("function"!=typeof e)throw new SyntaxError("Function parameter handler(resolve, reject) missing");var u=[],c=[];this.resolved=!1,this.rejected=!1,this.pending=!0;var a=function(e,r){u.push(e),c.push(r)};this.then=function(e,r){return new o((function(t,o){var i=e?n(e,t,o):t,s=r?n(r,t,o):o;a(i,s)}),t)};var f=function(e){return t.resolved=!0,t.rejected=!1,t.pending=!1,u.forEach((function(r){r(e)})),a=function(r,t){r(e)},f=p=function(){},t},p=function(e){return t.resolved=!1,t.rejected=!0,t.pending=!1,c.forEach((function(r){r(e)})),a=function(r,t){t(e)},f=p=function(){},t};this.cancel=function(){return r?r.cancel():p(new i),t},this.timeout=function(e){if(r)r.timeout(e);else{var o=setTimeout((function(){p(new s("Promise timed out after "+e+" ms"))}),e);t.always((function(){clearTimeout(o)}))}return t},e((function(e){f(e)}),(function(e){p(e)}))}function n(e,r,t){return function(o){try{var n=e(o);n&&"function"==typeof n.then&&"function"==typeof n.catch?n.then(r,t):r(n)}catch(e){t(e)}}}function i(e){this.message=e||"promise cancelled",this.stack=(new Error).stack}function s(e){this.message=e||"timeout exceeded",this.stack=(new Error).stack}o.prototype.catch=function(e){return this.then(null,e)},o.prototype.always=function(e){return this.then(e,e)},o.all=function(e){return new o((function(r,t){var o=e.length,n=[];o?e.forEach((function(e,i){e.then((function(e){n[i]=e,0==--o&&r(n)}),(function(e){o=0,t(e)}))})):r(n)}))},o.defer=function(){var e={};return e.promise=new o((function(r,t){e.resolve=r,e.reject=t})),e},i.prototype=new Error,i.prototype.constructor=Error,i.prototype.name="CancellationError",o.CancellationError=i,s.prototype=new Error,s.prototype.constructor=Error,s.prototype.name="TimeoutError",o.TimeoutError=s,e.exports=o},function(module,exports){var requireFoolWebpack=eval("typeof require !== 'undefined' ? require : function (module) { throw new Error('Module \" + module + \" not found.') }");module.exports=requireFoolWebpack},function(e,r,t){var o=t(0);r.pool=function(e,r){return new(t(4))(e,r)},r.worker=function(e){var r=t(8);r.add(e)},r.Promise=t(1),r.platform=o.platform,r.isMainThread=o.isMainThread,r.cpus=o.cpus},function(e,r,t){var o=t(1),n=t(5),i=t(0),s=new(t(7));function u(e,r){"string"==typeof e?this.script=e
//# sourceMappingURL=workerpool.min.js.map