init: working version

This commit is contained in:
Kiana Sheibani 2025-10-07 19:43:46 -04:00
commit 7d8d7dacae
Signed by: toki
GPG key ID: 6CB106C25E86A9F7
109 changed files with 15066 additions and 0 deletions

36
services/Requests.qml Normal file
View file

@ -0,0 +1,36 @@
pragma Singleton
import qs.config
import qs.util
import Quickshell
Singleton {
id: root
function get(url: string, callback: var): void {
const xhr = new XMLHttpRequest();
const cleanup = () => {
xhr.abort();
xhr.onreadystatechange = null;
xhr.onerror = null;
};
xhr.open("GET", url, true);
xhr.onreadystatechange = () => {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200)
callback(xhr.responseText);
else
console.warn(`[REQUESTS] GET request to ${url} failed with status ${xhr.status}`);
cleanup();
}
};
xhr.onerror = () => {
console.warn(`[REQUESTS] GET request to ${url} failed`);
cleanup();
};
xhr.send();
}
}