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

_baseDelay.js 672B

123456789101112131415161718192021
  1. /** Error message constants. */
  2. var FUNC_ERROR_TEXT = 'Expected a function';
  3. /**
  4. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  5. * to provide to `func`.
  6. *
  7. * @private
  8. * @param {Function} func The function to delay.
  9. * @param {number} wait The number of milliseconds to delay invocation.
  10. * @param {Array} args The arguments to provide to `func`.
  11. * @returns {number|Object} Returns the timer id or timeout object.
  12. */
  13. function baseDelay(func, wait, args) {
  14. if (typeof func != 'function') {
  15. throw new TypeError(FUNC_ERROR_TEXT);
  16. }
  17. return setTimeout(function() { func.apply(undefined, args); }, wait);
  18. }
  19. module.exports = baseDelay;