Skip to content

Commit

Permalink
Travis build: 837 [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis CI committed Jan 2, 2018
1 parent a8b1994 commit e9950a3
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
* [`chainAsync`](#chainasync)
* [`compose`](#compose)
* [`curry`](#curry)
* [`defer`](#defer)
* [`functionName`](#functionname)
* [`memoize`](#memoize)
* [`runPromisesInSeries`](#runpromisesinseries)
Expand Down Expand Up @@ -2378,6 +2379,34 @@ curry(Math.min, 3)(10)(50)(2); // 2
<br>[⬆ Back to top](#table-of-contents)


### defer

Defers invoking a function until the current call stack has cleared.

Use `setTimeout()` with a timeout of 1ms to add a new event to the browser event queue and allow the rendering engine to complete its work. Use the spread (`...`) operator to supply the function with an arbitrary number of arguments.

```js
const defer = (fn, ...args) => setTimeout(fn, 1, ...args);
```

<details>
<summary>Examples</summary>

```js
// Example A:
defer(console.log, 'a'), console.log('b'); // logs 'b' then 'a'

// Example B:
document.querySelector('#someElement').innerHTML = 'Hello';
longRunningFunction(); // the browser will not update the HTML until this has finished
defer(longRunningFunction); // the browser will update the HTML then run the function
```

</details>

<br>[⬆ Back to top](#table-of-contents)


### functionName

Logs the name of a function.
Expand Down
Loading

0 comments on commit e9950a3

Please sign in to comment.