1 | var $ = require('../internals/export');
|
2 | var global = require('../internals/global');
|
3 | var userAgent = require('../internals/user-agent');
|
4 |
|
5 | var slice = [].slice;
|
6 | var MSIE = /MSIE .\./.test(userAgent);
|
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 |
|
14 | (typeof handler == 'function' ? handler : Function(handler)).apply(this, args);
|
15 | } : handler, timeout);
|
16 | };
|
17 | };
|
18 |
|
19 |
|
20 |
|
21 | $({ global: true, bind: true, forced: MSIE }, {
|
22 |
|
23 |
|
24 | setTimeout: wrap(global.setTimeout),
|
25 |
|
26 |
|
27 | setInterval: wrap(global.setInterval)
|
28 | });
|