15 lines
270 B
JavaScript
15 lines
270 B
JavaScript
|
|
class GetJson {
|
|
constructor(url) {
|
|
this.url = url;
|
|
this.items = [];
|
|
}
|
|
|
|
async theData() {
|
|
const resp = await fetch(this.url);
|
|
console.assert(resp.status == 200, "failed to get it");
|
|
this.items = await resp.json();
|
|
return this.items;
|
|
}
|
|
}
|
|
|