after.js 231 B

1234567891011
  1. // Returns a function that will only be executed on and after the Nth call.
  2. function after(times, func) {
  3. return function() {
  4. if (--times < 1) {
  5. return func.apply(this, arguments);
  6. }
  7. };
  8. }
  9. module.exports = after;