phantasmal-world/src/new/core/gui/Button.ts

20 lines
429 B
TypeScript
Raw Normal View History

2019-08-20 04:56:40 +08:00
import { create_el } from "./dom";
import { View } from "./View";
import "./Button.css";
function dummy_function(): void {}
2019-08-20 04:56:40 +08:00
export class Button extends View {
element: HTMLButtonElement = create_el("button", "core_Button");
constructor(text: string) {
super();
this.element.textContent = text;
this.element.onclick = () => this.on_click();
2019-08-20 04:56:40 +08:00
}
on_click: () => void = dummy_function;
2019-08-20 04:56:40 +08:00
}