10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-07-23 03:07:44 +02:00

Fix bugs introduced in the last two commit

This commit is contained in:
Mickaël Véril 2019-09-05 11:31:38 +02:00
parent 9b1a445998
commit 01f2e6734b
2 changed files with 12 additions and 10 deletions

View File

@ -17,7 +17,7 @@
var file=filename+'.dat';
var lnk_file=document.getElementById('lnk_file');
lnk_file.setAttribute('href',getFullDataPath(file));
dat= await data.loadAsnyc(file);
dat= await data.loadAsync(file);
await applyData(dat);
}
async function applyData(dat) {
@ -71,7 +71,7 @@
</script>
<label>Write a data file name without extension<br/>
<input type="text" id='inp_filename' onkeydown="onKeyDown(e)"></input>
<input type="text" id='inp_filename' onkeydown="onKeyDown(event)"></input>
</label><br/>
<p id=data_par></p>
<a target="_blank" id='lnk_file' type='text/plain'>Go to file</a>

View File

@ -70,21 +70,23 @@ class data {
this.doi=null;
this.excitations=[];
}
static async loadAsync(file) {
return new Promise(function (resolve, reject) {
var req = new XMLHttpRequest();
req.open("GET",getFullDataPath(file), true);
req.onreadystatechange = function() {
if (req.readyState == 4 && req.status == 200) {//when a good response is given do this
static async loadAsync(file) {
return new Promise(function (resolve, reject) {
var req = new XMLHttpRequest();
req.open("GET",getFullDataPath(file), true);
req.onreadystatechange = function() {
if (req.readyState == 4) {
if (req.status == 200) {//when a good response is given do this
var text = req.responseText;
resolve(data.loadString(text))
resolve(data.loadString(text));
} else {
reject({
status: req.status,
statusText: req.statusText
});
}
};
}
}
req.send();
});
}