main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
793 bytes
|
Rev | Line | |
---|
[d565449] | 1 | import baseDelay from './_baseDelay.js';
|
---|
| 2 | import baseRest from './_baseRest.js';
|
---|
| 3 | import toNumber from './toNumber.js';
|
---|
| 4 |
|
---|
| 5 | /**
|
---|
| 6 | * Invokes `func` after `wait` milliseconds. Any additional arguments are
|
---|
| 7 | * provided to `func` when it's invoked.
|
---|
| 8 | *
|
---|
| 9 | * @static
|
---|
| 10 | * @memberOf _
|
---|
| 11 | * @since 0.1.0
|
---|
| 12 | * @category Function
|
---|
| 13 | * @param {Function} func The function to delay.
|
---|
| 14 | * @param {number} wait The number of milliseconds to delay invocation.
|
---|
| 15 | * @param {...*} [args] The arguments to invoke `func` with.
|
---|
| 16 | * @returns {number} Returns the timer id.
|
---|
| 17 | * @example
|
---|
| 18 | *
|
---|
| 19 | * _.delay(function(text) {
|
---|
| 20 | * console.log(text);
|
---|
| 21 | * }, 1000, 'later');
|
---|
| 22 | * // => Logs 'later' after one second.
|
---|
| 23 | */
|
---|
| 24 | var delay = baseRest(function(func, wait, args) {
|
---|
| 25 | return baseDelay(func, toNumber(wait) || 0, args);
|
---|
| 26 | });
|
---|
| 27 |
|
---|
| 28 | export default delay;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.