From d0255d6e9cc83716fbc0391fef6b491ddd8b0e75 Mon Sep 17 00:00:00 2001 From: Brendan Coles Date: Sat, 2 Apr 2016 07:04:40 +0000 Subject: [PATCH] Add timeout option to beef.net.cors.request --- core/main/client/net/cors.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/main/client/net/cors.js b/core/main/client/net/cors.js index cf12dcffe..7bb861d64 100644 --- a/core/main/client/net/cors.js +++ b/core/main/client/net/cors.js @@ -17,9 +17,10 @@ beef.net.cors = { * @param method {String} HTTP verb ('GET', 'POST', 'DELETE', etc.) * @param url {String} url * @param data {String} request body + * @param timeout {Integer} request timeout in milliseconds * @param callback {Function} function to callback on completion */ - request: function(method, url, data, callback) { + request: function(method, url, data, timeout, callback) { var xhr; var response = new this.response; @@ -29,6 +30,7 @@ beef.net.cors = { if ('withCredentials' in xhr) { xhr.open(method, url, true); + xhr.timeout = parseInt(timeout, 10); xhr.onerror = function() { }; xhr.onreadystatechange = function() {