[localeq] use js to get the hasInternet status

switching between Map.qml & Offline.qml now happens properly
main
demmm 5 years ago
parent e84193a2cb
commit fc91b4ce60

@ -34,6 +34,32 @@ Page {
//Needs to come from .conf/geoip
property var hasInternet: true
function getInt(format) {
var requestURL = "https://example.org/";
var xhr = new XMLHttpRequest;
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status !== 200) {
console.log("Disconnected!!");
var connected = false
hasInternet = connected
return;
}
else {
console.log("Connected!!");
}
}
}
xhr.open("GET", requestURL, true);
xhr.send();
}
Component.onCompleted: {
getInt();
}
Loader {
id: image
anchors.horizontalCenter: parent.horizontalCenter

Loading…
Cancel
Save