web.timers.js 706 B

1234567891011121314151617181920
  1. // ie9- setTimeout & setInterval additional parameters fix
  2. var global = require('./$.global')
  3. , $export = require('./$.export')
  4. , invoke = require('./$.invoke')
  5. , partial = require('./$.partial')
  6. , navigator = global.navigator
  7. , MSIE = !!navigator && /MSIE .\./.test(navigator.userAgent); // <- dirty ie9- check
  8. var wrap = function(set){
  9. return MSIE ? function(fn, time /*, ...args */){
  10. return set(invoke(
  11. partial,
  12. [].slice.call(arguments, 2),
  13. typeof fn == 'function' ? fn : Function(fn)
  14. ), time);
  15. } : set;
  16. };
  17. $export($export.G + $export.B + $export.F * MSIE, {
  18. setTimeout: wrap(global.setTimeout),
  19. setInterval: wrap(global.setInterval)
  20. });