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)
|
* [`composeRight`](#composeright)
|
||||||
* [`curry`](#curry)
|
* [`curry`](#curry)
|
||||||
* [`defer`](#defer)
|
* [`defer`](#defer)
|
||||||
|
* [`delay`](#delay)
|
||||||
* [`functionName`](#functionname)
|
* [`functionName`](#functionname)
|
||||||
* [`memoize`](#memoize)
|
* [`memoize`](#memoize)
|
||||||
* [`negate`](#negate)
|
* [`negate`](#negate)
|
||||||
@ -3360,6 +3361,35 @@ defer(longRunningFunction); // Browser will update the HTML then run the functio
|
|||||||
<br>[⬆ Back to top](#table-of-contents)
|
<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
|
### functionName
|
||||||
|
|
||||||
Logs the name of a function.
|
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
|
```js
|
||||||
delay(function(text) {
|
delay(
|
||||||
console.log(text);
|
function(text) {
|
||||||
}, 1000, 'later'); // Logs 'later' after one second.
|
console.log(text);
|
||||||
|
},
|
||||||
|
1000,
|
||||||
|
'later'
|
||||||
|
); // Logs 'later' after one second.
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user