added catalyst library

This commit is contained in:
Fran Jurmanović
2021-05-28 20:02:14 +02:00
parent e0756282b6
commit 95a729d7d0
17 changed files with 179 additions and 8 deletions

32
src/pages/home/Home.ts Normal file
View File

@@ -0,0 +1,32 @@
import { attr, targets, controller, target } from "@github/catalyst";
import { closest, index, update, isTrue } from "core/utils";
import { html, render, until } from "@github/jtml";
import { PingService } from "services";
@controller
class AppMainElement extends HTMLElement {
private pingService: PingService;
constructor() {
super();
this.pingService = new PingService();
}
@update
connectedCallback() {}
getPong = async () => {
try {
const response = await this.pingService.getAll();
return response.api;
} catch (err) {
console.log(err);
}
};
pongEl = () => {
return html`<div>${until(this.getPong())}</div>`;
};
update() {
render(html`${this.pongEl()}`, this);
}
}

View File

@@ -0,0 +1 @@
export * from "./home/Home";