##// END OF EJS Templates
Support for Function Components...
Support for Function Components Added JSX.IntrinsicElements

File last commit:

r34:e8012fdf09ae 1.0.0-rc16 default
r34:e8012fdf09ae 1.0.0-rc16 default
Show More
MyWidget.tsx
46 lines | 1.1 KiB | text/x-typescript | TypeScriptLexer
import { djbase, djclass, bind, prototype, AbstractConstructor } from "../declare";
import { DjxWidgetBase } from "../tsx/DjxWidgetBase";
import { createElement } from "../tsx";
interface MyWidgetAttrs {
title: string;
counter: number;
}
interface MyWidgetEvents {
"count-inc": Event;
"count-dec": Event;
}
@djclass
export class MyWidget extends djbase(DjxWidgetBase as AbstractConstructor<DjxWidgetBase<MyWidgetAttrs, MyWidgetEvents>>) {
@bind({ node: "titleNode", type: "innerHTML" })
title = "";
@prototype()
counter = 0;
render() {
const Frame = (props: any) => <div>{props.children}</div>;
return <div>
<h1 data-dojo-attach-point="titleNode"></h1>
<Frame>
<span class="up-button" onclick={e => this._onIncClick(e)}>[+]</span>
<span class="down-button" onclick={() => this._onDecClick()}>[-]</span>
</Frame>
</div>;
}
_onIncClick(e: MouseEvent) {
this.emit("count-inc", { bubbles: false });
}
_onDecClick() {
this.emit("count-dec", { bubbles: false });
}
}