Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

nextTick.js 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _setImmediate = require('./internal/setImmediate');
  6. /**
  7. * Calls `callback` on a later loop around the event loop. In Node.js this just
  8. * calls `process.nextTick`. In the browser it will use `setImmediate` if
  9. * available, otherwise `setTimeout(callback, 0)`, which means other higher
  10. * priority events may precede the execution of `callback`.
  11. *
  12. * This is used internally for browser-compatibility purposes.
  13. *
  14. * @name nextTick
  15. * @static
  16. * @memberOf module:Utils
  17. * @method
  18. * @see [async.setImmediate]{@link module:Utils.setImmediate}
  19. * @category Util
  20. * @param {Function} callback - The function to call on a later loop around
  21. * the event loop. Invoked with (args...).
  22. * @param {...*} args... - any number of additional arguments to pass to the
  23. * callback on the next tick.
  24. * @example
  25. *
  26. * var call_order = [];
  27. * async.nextTick(function() {
  28. * call_order.push('two');
  29. * // call_order now equals ['one','two']
  30. * });
  31. * call_order.push('one');
  32. *
  33. * async.setImmediate(function (a, b, c) {
  34. * // a, b, and c equal 1, 2, and 3
  35. * }, 1, 2, 3);
  36. */
  37. var _defer;
  38. if (_setImmediate.hasNextTick) {
  39. _defer = process.nextTick;
  40. } else if (_setImmediate.hasSetImmediate) {
  41. _defer = setImmediate;
  42. } else {
  43. _defer = _setImmediate.fallback;
  44. }
  45. exports.default = (0, _setImmediate.wrap)(_defer);
  46. module.exports = exports['default'];