Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_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;