Update promisify.md
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: promisify
|
title: promisify
|
||||||
tags: adapter,function,promise,intermediate
|
tags: function,promise,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Converts an asynchronous function to return a promise.
|
Converts an asynchronous function to return a promise.
|
||||||
@ -20,4 +20,4 @@ const promisify = func => (...args) =>
|
|||||||
```js
|
```js
|
||||||
const delay = promisify((d, cb) => setTimeout(cb, d));
|
const delay = promisify((d, cb) => setTimeout(cb, d));
|
||||||
delay(2000).then(() => console.log('Hi!')); // // Promise resolves after 2s
|
delay(2000).then(() => console.log('Hi!')); // // Promise resolves after 2s
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user