MCPcopy Create free account
hub / github.com/alefore/knit / constructor

Method constructor

src/control_button.ts:9–23  ·  view source on GitHub ↗
(
      id: string|null, text: string, description: string,
      action: (e: MouseEvent) => void)

Source from the content-addressed store, hash-verified

7 private htmlObject: HTMLInputElement;
8
9 constructor(
10 id: string|null, text: string, description: string,
11 action: (e: MouseEvent) => void) {
12 this.text = text;
13 this.description = description;
14 const button = document.createElement(htmlTags.input) as HTMLInputElement;
15 button.type = htmlInputTypes.submit;
16 button.value = this.text;
17 button.title = this.description;
18 if (id) {
19 button.id = id;
20 }
21 button.addEventListener('click', action);
22 this.htmlObject = button;
23 }
24
25 appendHtml(container: HTMLElement): this {
26 container.appendChild(this.htmlObject);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected