/zd-timeout

0 deps async (callback) function timeout

Primary LanguageJavaScript

Build Status Known Vulnerabilities Coverage Status

zd-timeout

Set a timeout for an async (callback async) function

Install

$ npm install zd-timeout

Usage

const {
    timeout
} = require('zd-timeout');

function request(a, b, callback){/*...*/}
let requestLimitedTo1Minute = timeout(request, 60 * 1000);
var a = 1;
var b = 2;
requestLimitedTo1Minute(a, b, function(err, data){/*...*/}

API

  • timeout(fn, milliseconds)