mirror of
https://github.com/swc-project/swc.git
synced 2024-12-20 20:22:26 +03:00
bbaf619f63
swc_bundler: - [x] Fix wrapped esms. (denoland/deno#9307) - [x] Make test secure.
4 lines
3.4 KiB
TypeScript
4 lines
3.4 KiB
TypeScript
// Loaded from https://raw.githubusercontent.com/denjucks/dex/master/lib/deps/@jspm/core@1.1.0/nodelibs/timers.js
|
|
|
|
|
|
import {h}from'./chunk-0c2d1322.js';var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:global,n={},a=h;!function(e,t){if(!e.setImmediate){var n,s,o,i,c,r=1,f={},l=!1,d=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,"[object process]"==={}.toString.call(e.process)?n=function(e){a.nextTick((function(){m(e);}));}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1;},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((o=new MessageChannel).port1.onmessage=function(e){m(e.data);},n=function(e){o.port2.postMessage(e);}):d&&"onreadystatechange"in d.createElement("script")?(s=d.documentElement,n=function(e){var t=d.createElement("script");t.onreadystatechange=function(){m(e),t.onreadystatechange=null,s.removeChild(t),t=null;},s.appendChild(t);}):n=function(e){setTimeout(m,0,e);}:(i="setImmediate$"+Math.random()+"$",c=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(i)&&m(+t.data.slice(i.length));},e.addEventListener?e.addEventListener("message",c,!1):e.attachEvent("onmessage",c),n=function(t){e.postMessage(i+t,"*");}),u.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),a=0;a<t.length;a++)t[a]=arguments[a+1];var s={callback:e,args:t};return f[r]=s,n(r),r++},u.clearImmediate=g;}function g(e){delete f[e];}function m(e){if(l)setTimeout(m,0,e);else {var t=f[e];if(t){l=!0;try{!function(e){var t=e.callback,n=e.args;switch(n.length){case 0:t();break;case 1:t(n[0]);break;case 2:t(n[0],n[1]);break;case 3:t(n[0],n[1],n[2]);break;default:t.apply(void 0,n);}}(t);}finally{g(e),l=!1;}}}}}("undefined"==typeof self?void 0===t?n:t:self);var t$1="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:global,i={},o=void 0!==t$1&&t$1||"undefined"!=typeof self&&self||window,l=Function.prototype.apply;function n$1(e,i){(this||t$1)._id=e,(this||t$1)._clearFn=i;}i.setTimeout=function(){return new n$1(l.call(setTimeout,o,arguments),clearTimeout)},i.setInterval=function(){return new n$1(l.call(setInterval,o,arguments),clearInterval)},i.clearTimeout=i.clearInterval=function(e){e&&e.close();},n$1.prototype.unref=n$1.prototype.ref=function(){},n$1.prototype.close=function(){(this||t$1)._clearFn.call(o,(this||t$1)._id);},i.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t;},i.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1;},i._unrefActive=i.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout();}),t));},i.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t$1&&t$1.setImmediate||i&&i.setImmediate,i.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t$1&&t$1.clearImmediate||i&&i.clearImmediate;var _unrefActive=i._unrefActive;var active=i.active;var clearImmediate=i.clearImmediate;var clearInterval$1=i.clearInterval;var clearTimeout$1=i.clearTimeout;var enroll=i.enroll;var setImmediate=i.setImmediate;var setInterval$1=i.setInterval;var setTimeout$1=i.setTimeout;var unenroll=i.unenroll;export default i;export{_unrefActive,active,clearImmediate,clearInterval$1 as clearInterval,clearTimeout$1 as clearTimeout,enroll,setImmediate,setInterval$1 as setInterval,setTimeout$1 as setTimeout,unenroll}; |