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

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.hasNextTick = exports.hasSetImmediate = undefined;
  6. exports.fallback = fallback;
  7. exports.wrap = wrap;
  8. var _slice = require('./slice');
  9. var _slice2 = _interopRequireDefault(_slice);
  10. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  11. var hasSetImmediate = exports.hasSetImmediate = typeof setImmediate === 'function' && setImmediate;
  12. var hasNextTick = exports.hasNextTick = typeof process === 'object' && typeof process.nextTick === 'function';
  13. function fallback(fn) {
  14. setTimeout(fn, 0);
  15. }
  16. function wrap(defer) {
  17. return function (fn /*, ...args*/) {
  18. var args = (0, _slice2.default)(arguments, 1);
  19. defer(function () {
  20. fn.apply(null, args);
  21. });
  22. };
  23. }
  24. var _defer;
  25. if (hasSetImmediate) {
  26. _defer = setImmediate;
  27. } else if (hasNextTick) {
  28. _defer = process.nextTick;
  29. } else {
  30. _defer = fallback;
  31. }
  32. exports.default = wrap(_defer);