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

@@ -6,7 +6,7 @@
"start": "npm run build && node node_modules/@darkflippers/fz-sdk-ul/sdk.js upload"
},
"devDependencies": {
"@darkflippers/fz-sdk-ul": "^0.1",
"@next-flip/fz-sdk-mntm": "^0.3",
"typescript": "^5.6.3"
}
}

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;