mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 17:07:49 +00:00
first batch of documentation
This commit is contained in:
@@ -283,6 +283,29 @@ window._ = {
|
||||
});
|
||||
},
|
||||
|
||||
// Delays a function for the given number of milliseconds, and then calls
|
||||
// it with the arguments supplied.
|
||||
delay : function(func, wait) {
|
||||
var args = _.toArray(arguments).slice(2);
|
||||
return window.setTimeout(function(){ return func.apply(func, args); }, wait);
|
||||
},
|
||||
|
||||
// Defers a function, scheduling it to run after the current call stack has
|
||||
// cleared.
|
||||
defer : function(func) {
|
||||
return _.delay.apply(_, [func, 1].concat(_.toArray(arguments).slice(1)));
|
||||
},
|
||||
|
||||
// Returns the first function passed as an argument to the second,
|
||||
// allowing you to adjust arguments, run code before and after, and
|
||||
// conditionally execute the original function.
|
||||
wrap : function(func, wrapper) {
|
||||
return function() {
|
||||
var args = [func].concat(_.toArray(arguments));
|
||||
return wrapper.apply(wrapper, args);
|
||||
};
|
||||
},
|
||||
|
||||
/* ---------------- The following methods apply to objects ---------------- */
|
||||
|
||||
// Retrieve the names of an object's properties.
|
||||
|
||||
Reference in New Issue
Block a user