.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / core-js / modules / web.timers.js
1 var $ = require('../internals/export');
2 var global = require('../internals/global');
3 var userAgent = require('../internals/engine-user-agent');
4
5 var slice = [].slice;
6 var MSIE = /MSIE .\./.test(userAgent); // <- dirty ie9- check
7
8 var wrap = function (scheduler) {
9   return function (handler, timeout /* , ...arguments */) {
10     var boundArgs = arguments.length > 2;
11     var args = boundArgs ? slice.call(arguments, 2) : undefined;
12     return scheduler(boundArgs ? function () {
13       // eslint-disable-next-line no-new-func -- spec requirement
14       (typeof handler == 'function' ? handler : Function(handler)).apply(this, args);
15     } : handler, timeout);
16   };
17 };
18
19 // ie9- setTimeout & setInterval additional parameters fix
20 // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers
21 $({ global: true, bind: true, forced: MSIE }, {
22   // `setTimeout` method
23   // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout
24   setTimeout: wrap(global.setTimeout),
25   // `setInterval` method
26   // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval
27   setInterval: wrap(global.setInterval)
28 });