delay.js 340 B

1234567891011121314
  1. define(['./restArguments'], function (restArguments) {
  2. // Delays a function for the given number of milliseconds, and then calls
  3. // it with the arguments supplied.
  4. var delay = restArguments(function(func, wait, args) {
  5. return setTimeout(function() {
  6. return func.apply(null, args);
  7. }, wait);
  8. });
  9. return delay;
  10. });