Hi! For anyone trying to make this library work on cordova/ionic/phonegap:
I monkey patched the core script so it uses XMLHttpRequest instead of fetch. This makes it compatible with an android
build.
cleaner code on https://pastebin.pl/view/f40271e2
let location = this.location.href;
return new Promise(function (resolve, reject) {
let xhr = new XMLHttpRequest();
xhr.open("GET", location);
xhr.setRequestHeader("X-Requested-With", "Hightway");
xhr.withCredentials = true;
xhr.onreadystatechange = function () {
// Only run if the request is complete
// Process our return data
if (xhr.readyState === 4) {
if (xhr.status == 200) {
// or xhr.status >= 200 && xhr.status < 300
resolve(xhr.responseText);
} else {
reject("false");
}
}
};
xhr.send();
});
}
async fetch() {
return this.xhr_fetch();
}
Hi! For anyone trying to make this library work on cordova/ionic/phonegap: I monkey patched the core script so it uses XMLHttpRequest instead of fetch. This makes it compatible with an android build. cleaner code on https://pastebin.pl/view/f40271e2