1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-24 01:42:26 +01:00

Perform search-suggest query asynchronously via async http request rather than background thread.

This commit is contained in:
Kris Maglione
2008-11-28 18:51:28 +00:00
parent 4c914e9907
commit 5fdf4bd6d6
3 changed files with 35 additions and 16 deletions

View File

@@ -285,18 +285,25 @@ const util = { //{{{
return ret;
},
httpGet: function httpGet(url)
httpGet: function httpGet(url, callback)
{
try
{
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", url, false);
let xmlhttp = new XMLHttpRequest();
if (callback)
{
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4)
callback(xmlhttp)
}
}
xmlhttp.open("GET", url, !!callback);
xmlhttp.send(null);
return xmlhttp;
}
catch (e)
{
liberator.log("Error opening " + url, 1);
liberator.log("Error opening " + url + ": " + e, 1);
}
},