From f131e6877c40d4755d5ed44d1f88622d2811a235 Mon Sep 17 00:00:00 2001 From: Augusto Franzoia Date: Mon, 7 Mar 2016 22:38:39 -0300 Subject: Add entry for async.timeout in README --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'README.md') 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. + +--------------------------------------- + + +### 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); +``` -- cgit v1.2.1