Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add entry for async.timeout in README #1051

Merged
merged 1 commit into from
Mar 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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