Merge remote-tracking branch 'origin/master'
This commit is contained in:
30
README.md
30
README.md
@ -224,6 +224,7 @@ average(1, 2, 3);
|
||||
* [`composeRight`](#composeright)
|
||||
* [`curry`](#curry)
|
||||
* [`defer`](#defer)
|
||||
* [`delay`](#delay)
|
||||
* [`functionName`](#functionname)
|
||||
* [`memoize`](#memoize)
|
||||
* [`negate`](#negate)
|
||||
@ -3360,6 +3361,35 @@ defer(longRunningFunction); // Browser will update the HTML then run the functio
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
|
||||
### defer
|
||||
|
||||
Invokes the provided function after `wait` milliseconds.
|
||||
|
||||
Use `setTimeout()` to delay execution of `fn`.
|
||||
Use the spread (`...`) operator to supply the function with an arbitrary number of arguments.
|
||||
|
||||
```js
|
||||
const delay = (fn, wait, ...args) => setTimeout(fn, wait, ...args);
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Examples</summary>
|
||||
|
||||
```js
|
||||
delay(
|
||||
function(text) {
|
||||
console.log(text);
|
||||
},
|
||||
1000,
|
||||
'later'
|
||||
); // Logs 'later' after one second.
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
|
||||
### functionName
|
||||
|
||||
Logs the name of a function.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -10,7 +10,11 @@ const delay = (fn, wait, ...args) => setTimeout(fn, wait, ...args);
|
||||
```
|
||||
|
||||
```js
|
||||
delay(function(text) {
|
||||
console.log(text);
|
||||
}, 1000, 'later'); // Logs 'later' after one second.
|
||||
delay(
|
||||
function(text) {
|
||||
console.log(text);
|
||||
},
|
||||
1000,
|
||||
'later'
|
||||
); // Logs 'later' after one second.
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user