My LoRaWAN Signal Mapping MSc summer project. This is a copy of the actual repository with personal information removed.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

24 lines
748 B

"use strict";
/**
* Fetches content from the given URL and returns it via a Promise.
* Original source: https://gist.github.com/0b2aee73f8d168e36a353901193e7ff5#file-getfromurl-js
* Proof that I wrote this is, of course, available upon request.
*
* @param {string} url The url to fetch the content from.
* @returns {Promise<string>} The content at the specified url.
*/
export default function GetFromUrl(url) {
return new Promise(function(resolve, reject) {
let request = new XMLHttpRequest();
request.addEventListener("load", function() {
if (request.status > 199 && request.status < 300)
resolve(request.response);
else
reject(request.response);
});
request.open("GET", url, true);
request.send(null);
})
}