immediate.js 498 B

12345678910111213141516
  1. /*!
  2. * Centralize this so we can more easily work around issues with people
  3. * stubbing out `process.nextTick()` in tests using sinon:
  4. * https://github.com/sinonjs/lolex#automatically-incrementing-mocked-time
  5. * See gh-6074
  6. */
  7. 'use strict';
  8. const nextTick = typeof process !== 'undefined' && typeof process.nextTick === 'function' ?
  9. process.nextTick.bind(process) :
  10. cb => setTimeout(cb, 0); // Fallback for browser build
  11. module.exports = function immediate(cb) {
  12. return nextTick(cb);
  13. };