JS: Expose button event type in gui/widget button callback

by WillyJL
This commit is contained in:
MX
2025-07-30 05:04:02 +03:00
parent 610fd68b75
commit 7646902fdc
7 changed files with 72 additions and 17 deletions

View File

@@ -58,12 +58,16 @@ type Element = StringMultilineElement
type Props = {};
type Child = Element;
declare class ButtonEvent {
key: "left" | "center" | "right";
type: "press" | "release" | "short" | "long" | "repeat";
}
declare class Widget extends View<Props, Child> {
/**
* Event source for buttons. Only gets fired if there's a corresponding
* button element.
*/
button: Contract<"left" | "center" | "right">;
button: Contract<ButtonEvent>;
}
declare class WidgetFactory extends ViewFactory<Props, Child, Widget> { }
declare const factory: WidgetFactory;