Every line of 'xmlhttprequest timeout' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
3 export function setSocketTimeout( 4 request: ClientRequest, 5 reject: (err: Error) => void, 6 timeoutInMs: number = 0 7 ) { 8 request.setTimeout(timeoutInMs, function(this: ClientRequest) { 9 // abort the request to destroy it 10 this.abort(); 11 const timeoutError = new Error( 12 `Connection timed out after ${timeoutInMs} ms` 13 ); 14 timeoutError.name = "TimeoutError"; 15 reject(timeoutError); 16 }); 17 }
452 _timeout() { 453 this._cleanupConnect(true); 454 455 if (this.maxTries == -1 || this._tries < this.maxTries) { 456 this._retry(); 457 } else { 458 this._error(ErrorTypes.TimeoutError); 459 } 460 }
97 function ajaxTimeout(){ 98 console.log("Request aborted"); 99 req.abort(); 100 window.clearInterval(xmlHttpTimeout); 101 }
88 function getTimeout(timeout) { 89 return timeout || 20000; 90 }
224 requestTimer = setTimeout(function requestTimeout() { 225 requestTimer = null; 226 227 var err = new RequestTimeoutError(opts.requestTimeout); 228 dtrace._rstfy_probes['client-error'].fire(function () { 229 return ([id, err.toString()]); 230 }); 231 232 cb(err, req); 233 234 if (req) { 235 req.abort(); 236 process.nextTick(function () { 237 req.emit('result', err, null); 238 }); 239 } 240 }, opts.requestTimeout);