Skip to content

Commit

Permalink
Merge pull request #1051 from ajfranzoia/timeout-docs
Browse files Browse the repository at this point in the history
Add entry for async.timeout in README
  • Loading branch information
aearly committed Mar 8, 2016
2 parents 4f61814 + f131e68 commit 07208a6
Show file tree
Hide file tree
Showing 2 changed files with 1,951 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ Some functions are also available in the following forms:
* [`log`](#log)
* [`dir`](#dir)
* [`noConflict`](#noConflict)
* [`timeout`](#timeout)
## Collections
Expand Down Expand Up @@ -1903,3 +1904,25 @@ node> async.dir(hello, 'world');
Changes the value of `async` back to its original value, returning a reference to the
`async` object.
---------------------------------------
<a name="timeout"></a>
### timeout(function, miliseconds)
Sets a time limit on an asynchronous function. If the function does not call its callback within the specified miliseconds, it will be called with a timeout error. The code property for the error object will be `'ETIMEDOUT'`.
Returns a wrapped function that can be used with any of the control flow functions.
__Arguments__
* `function` - The asynchronous function you want to set the time limit.
* `miliseconds` - The specified time limit.

__Example__

```js
async.timeout(function(callback) {
doAsyncTask(callback);
}, 1000);
```
Loading

0 comments on commit 07208a6

Please sign in to comment.