changeset 267:96ce03724648 gmap2

Add error handler callback.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 13 Apr 2014 21:23:07 +0300
parents b50a7ab76548
children 98115d71bb64
files lib/util.js
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lib/util.js	Sun Apr 13 20:55:50 2014 +0300
+++ b/lib/util.js	Sun Apr 13 21:23:07 2014 +0300
@@ -14,7 +14,7 @@
 }
 
 
-function XDownloadUrl(url, callback)
+function XDownloadUrl(url, callback, errcallback)
 {
  var status = -1;
  var request = XCreateXmlHTTPRequest();
@@ -36,6 +36,9 @@
        callback(request.responseText, request.status);
        request.onreadystatechange = function() {};
      }
+     else
+     if (typeof(errcallback) == "function")
+      errcallback(status);
    }
  }