Initial commit
[yaffs-website] / node_modules / grunt-contrib-watch / node_modules / lodash / function / defer.js
1 var baseDelay = require('../internal/baseDelay'),
2     restParam = require('./restParam');
3
4 /**
5  * Defers invoking the `func` until the current call stack has cleared. Any
6  * additional arguments are provided to `func` when it's invoked.
7  *
8  * @static
9  * @memberOf _
10  * @category Function
11  * @param {Function} func The function to defer.
12  * @param {...*} [args] The arguments to invoke the function with.
13  * @returns {number} Returns the timer id.
14  * @example
15  *
16  * _.defer(function(text) {
17  *   console.log(text);
18  * }, 'deferred');
19  * // logs 'deferred' after one or more milliseconds
20  */
21 var defer = restParam(function(func, args) {
22   return baseDelay(func, 1, args);
23 });
24
25 module.exports = defer;