summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorAugusto Franzoia <ajfranzoia@gmail.com>2016-03-07 22:38:39 -0300
committerAugusto Franzoia <ajfranzoia@gmail.com>2016-03-07 23:17:19 -0300
commitf131e6877c40d4755d5ed44d1f88622d2811a235 (patch)
treebd2b4ad8d4c4326ea349786b4c98c824dd5565f2 /README.md
parent4f6181459a43bbffab9493f08e26383d9b68ef52 (diff)
downloadasync-f131e6877c40d4755d5ed44d1f88622d2811a235.tar.gz
Add entry for async.timeout in README
Diffstat (limited to 'README.md')
-rw-r--r--README.md23
1 files changed, 23 insertions, 0 deletions
diff --git a/README.md b/README.md
index 02f9418..c7ec1a1 100644
--- a/README.md
+++ b/README.md
@@ -237,6 +237,7 @@ Some functions are also available in the following forms:
* [`log`](#log)
* [`dir`](#dir)
* [`noConflict`](#noConflict)
+* [`timeout`](#timeout)
## Collections
@@ -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);
+```