diff options
Diffstat (limited to 'node_modules/core-js/modules/web.timers.js')
| -rw-r--r-- | node_modules/core-js/modules/web.timers.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/node_modules/core-js/modules/web.timers.js b/node_modules/core-js/modules/web.timers.js new file mode 100644 index 0000000..0a4a7fc --- /dev/null +++ b/node_modules/core-js/modules/web.timers.js @@ -0,0 +1,28 @@ +var $ = require('../internals/export'); +var global = require('../internals/global'); +var userAgent = require('../internals/engine-user-agent'); + +var slice = [].slice; +var MSIE = /MSIE .\./.test(userAgent); // <- dirty ie9- check + +var wrap = function (scheduler) { + return function (handler, timeout /* , ...arguments */) { + var boundArgs = arguments.length > 2; + var args = boundArgs ? slice.call(arguments, 2) : undefined; + return scheduler(boundArgs ? function () { + // eslint-disable-next-line no-new-func + (typeof handler == 'function' ? handler : Function(handler)).apply(this, args); + } : handler, timeout); + }; +}; + +// ie9- setTimeout & setInterval additional parameters fix +// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers +$({ global: true, bind: true, forced: MSIE }, { + // `setTimeout` method + // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout + setTimeout: wrap(global.setTimeout), + // `setInterval` method + // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval + setInterval: wrap(global.setInterval) +}); |
