Last change
on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
693 bytes
|
Line | |
---|
1 | var baseDelay = require('./_baseDelay'),
|
---|
2 | baseRest = require('./_baseRest');
|
---|
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 | module.exports = defer;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.