setImmediate.js 1.4 KB

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