setImmediate.js

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