|
@@ -1,25 +1,28 @@
|
|
|
import radiomanifest from "@radiomanifest/radiomanifest";
|
|
|
|
|
|
-const knownRadios = ["https://www.ondarossa.info", "https://radiospore.oziosi.org"]
|
|
|
+const knownRadios = [
|
|
|
+ "https://www.ondarossa.info",
|
|
|
+ "https://radiospore.oziosi.org",
|
|
|
+];
|
|
|
class Controller {
|
|
|
constructor() {
|
|
|
- this.cache = {}
|
|
|
- this.currentRadio = null
|
|
|
+ this.cache = {};
|
|
|
+ this.currentRadio = null;
|
|
|
|
|
|
- for(let r in knownRadios) {
|
|
|
+ for (let r in knownRadios) {
|
|
|
this.get(r);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
async get(url) {
|
|
|
- if(this.cache[url]) {
|
|
|
+ if (this.cache[url]) {
|
|
|
this.currentRadio = this.cache[url];
|
|
|
return this.cache[url];
|
|
|
}
|
|
|
this.cache[url] = knownRadios[url];
|
|
|
// fetch more data in background
|
|
|
- this.cache[url] = await radiomanifest.get(url)
|
|
|
- return this.cache[url]
|
|
|
+ this.cache[url] = await radiomanifest.get(url);
|
|
|
+ return this.cache[url];
|
|
|
}
|
|
|
}
|
|
|
|