import { djbase, djclass, bind, prototype, AbstractConstructor } from "../declare"; import { DjxWidgetBase } from "../tsx/DjxWidgetBase"; import { createElement } from "../tsx"; import { on } from "../tsx/traits"; interface MyWidgetAttrs { title: string; counter: number; } interface MyWidgetEvents { "count-inc": Event & { detail: number; }; "count-dec": Event & { detail: number; }; } @djclass export class MyWidget extends djbase(DjxWidgetBase as AbstractConstructor>) { @bind({ node: "titleNode", type: "innerHTML" }) title = ""; @prototype() counter = 0; render() { const Frame = (props: any) =>
{props.children}
; return
this._onSubmit(e)} tabIndex={3} style={{ alignContent: "center", border: "1px solid" }} >

this._onIncClick(e)}>[+] this._onDecClick()}>[-]
; } postCreate() { super.postCreate(); this.on("click", () => {}); } _onSubmit(e: Event) { } _onIncClick(e: MouseEvent) { this.set("counter", this.counter + 1); this.emit("count-inc", { bubbles: false }); } _onDecClick() { this.emit("count-dec", { bubbles: false, detail: this.counter }); } @on("count-inc") _onCounterInc(evt: Event & { detail: number; x?: number; }) { } @on("click") protected _onClick() { } }