main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
691 bytes
|
Rev | Line | |
---|
[d565449] | 1 | import baseDelay from './_baseDelay.js';
|
---|
| 2 | import baseRest from './_baseRest.js';
|
---|
| 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 | * @since 0.1.0
|
---|
| 11 | * @category Function
|
---|
| 12 | * @param {Function} func The function to defer.
|
---|
| 13 | * @param {...*} [args] The arguments to invoke `func` with.
|
---|
| 14 | * @returns {number} Returns the timer id.
|
---|
| 15 | * @example
|
---|
| 16 | *
|
---|
| 17 | * _.defer(function(text) {
|
---|
| 18 | * console.log(text);
|
---|
| 19 | * }, 'deferred');
|
---|
| 20 | * // => Logs 'deferred' after one millisecond.
|
---|
| 21 | */
|
---|
| 22 | var defer = baseRest(function(func, args) {
|
---|
| 23 | return baseDelay(func, 1, args);
|
---|
| 24 | });
|
---|
| 25 |
|
---|
| 26 | export default defer;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.