Last change
on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[6a3a178] | 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 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.