您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

delay.js 795B

12345678910111213141516171819202122232425262728
  1. var baseDelay = require('./_baseDelay'),
  2. baseRest = require('./_baseRest'),
  3. toNumber = require('./toNumber');
  4. /**
  5. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  6. * provided to `func` when it's invoked.
  7. *
  8. * @static
  9. * @memberOf _
  10. * @since 0.1.0
  11. * @category Function
  12. * @param {Function} func The function to delay.
  13. * @param {number} wait The number of milliseconds to delay invocation.
  14. * @param {...*} [args] The arguments to invoke `func` with.
  15. * @returns {number} Returns the timer id.
  16. * @example
  17. *
  18. * _.delay(function(text) {
  19. * console.log(text);
  20. * }, 1000, 'later');
  21. * // => Logs 'later' after one second.
  22. */
  23. var delay = baseRest(function(func, wait, args) {
  24. return baseDelay(func, toNumber(wait) || 0, args);
  25. });
  26. module.exports = delay;