source: imaps-frontend/node_modules/core-js/internals/schedulers-fix.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.5 KB
Line 
1'use strict';
2var globalThis = require('../internals/global-this');
3var apply = require('../internals/function-apply');
4var isCallable = require('../internals/is-callable');
5var ENVIRONMENT = require('../internals/environment');
6var USER_AGENT = require('../internals/environment-user-agent');
7var arraySlice = require('../internals/array-slice');
8var validateArgumentsLength = require('../internals/validate-arguments-length');
9
10var Function = globalThis.Function;
11// dirty IE9- and Bun 0.3.0- checks
12var WRAP = /MSIE .\./.test(USER_AGENT) || ENVIRONMENT === 'BUN' && (function () {
13 var version = globalThis.Bun.version.split('.');
14 return version.length < 3 || version[0] === '0' && (version[1] < 3 || version[1] === '3' && version[2] === '0');
15})();
16
17// IE9- / Bun 0.3.0- setTimeout / setInterval / setImmediate additional parameters fix
18// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers
19// https://github.com/oven-sh/bun/issues/1633
20module.exports = function (scheduler, hasTimeArg) {
21 var firstParamIndex = hasTimeArg ? 2 : 1;
22 return WRAP ? function (handler, timeout /* , ...arguments */) {
23 var boundArgs = validateArgumentsLength(arguments.length, 1) > firstParamIndex;
24 var fn = isCallable(handler) ? handler : Function(handler);
25 var params = boundArgs ? arraySlice(arguments, firstParamIndex) : [];
26 var callback = boundArgs ? function () {
27 apply(fn, this, params);
28 } : fn;
29 return hasTimeArg ? scheduler(callback, timeout) : scheduler(callback);
30 } : scheduler;
31};
Note: See TracBrowser for help on using the repository browser.