All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.amd.before.js Maven / Gradle / Ivy

The newest version!
define(function () {

  // Returns a function that will only be executed up to (but not including) the
  // Nth call.
  function before(times, func) {
    var memo;
    return function() {
      if (--times > 0) {
        memo = func.apply(this, arguments);
      }
      if (times <= 1) func = null;
      return memo;
    };
  }

  return before;

});




© 2015 - 2024 Weber Informatics LLC | Privacy Policy