Javascript library that provides the option to call a callback function with default arguments if an async function takes too long.
var ta = require('timeout-async')
- function - async function that should be called
- number - amount time that should elapse before the callback function is called with default arguments
- array - default arguments for the callback function
- array - arguments to the async function (including the callback function)
var ta = require('timeout-async')
var request = require('request')
ta(request.get, 5000, ['default-err', 'default-response', 'default-body'], [{url: 'http://my-ip.herokuapp.com'}, function(err, response, body) {
console.log(err, response, body)
}])