wallet-core/node_modules/core-js/modules/web.timers.js

21 lines
754 B
JavaScript
Raw Normal View History

2016-10-10 03:43:44 +02:00
// ie9- setTimeout & setInterval additional parameters fix
2017-08-14 05:01:11 +02:00
var global = require('./_global');
var $export = require('./_export');
2017-12-27 19:33:54 +01:00
var userAgent = require('./_user-agent');
var slice = [].slice;
var MSIE = /MSIE .\./.test(userAgent); // <- dirty ie9- check
2017-08-14 05:01:11 +02:00
var wrap = function (set) {
2017-12-27 19:33:54 +01:00
return function (fn, time /* , ...args */) {
var boundArgs = arguments.length > 2;
var args = boundArgs ? slice.call(arguments, 2) : false;
return set(boundArgs ? function () {
2017-08-14 05:01:11 +02:00
// eslint-disable-next-line no-new-func
2017-12-27 19:33:54 +01:00
(typeof fn == 'function' ? fn : Function(fn)).apply(this, args);
} : fn, time);
};
2016-10-10 03:43:44 +02:00
};
$export($export.G + $export.B + $export.F * MSIE, {
2017-08-14 05:01:11 +02:00
setTimeout: wrap(global.setTimeout),
2016-10-10 03:43:44 +02:00
setInterval: wrap(global.setInterval)
2017-08-14 05:01:11 +02:00
});