diff options
Diffstat (limited to 'services')
| -rw-r--r-- | services/Requests.qml | 36 | ||||
| -rw-r--r-- | services/Weather.qml | 1 |
2 files changed, 1 insertions, 36 deletions
diff --git a/services/Requests.qml b/services/Requests.qml deleted file mode 100644 index a6a1d1d..0000000 --- a/services/Requests.qml +++ /dev/null @@ -1,36 +0,0 @@ -pragma Singleton - -import qs.config -import qs.utils -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(); - } -} diff --git a/services/Weather.qml b/services/Weather.qml index f3147a8..73e0b77 100644 --- a/services/Weather.qml +++ b/services/Weather.qml @@ -2,6 +2,7 @@ pragma Singleton import qs.config import qs.utils +import Caelestia import Quickshell import QtQuick |